Create a PHP REST API : Write a RESTful API from Scratch using Plain, Object-Oriented PHP and MySQL

แชร์
ฝัง

ความคิดเห็น • 201

  • @dave-hollingworth
    @dave-hollingworth  2 ปีที่แล้ว +25

    Out of interest, what data are you creating an API for?

    • @efbYouTube
      @efbYouTube 2 ปีที่แล้ว +3

      fun pet project (10 yrs in the making! 🙃) to create a user login & personal data store for a language gaming website using vanilla js (& react) on the ft end.

    • @william254
      @william254 2 ปีที่แล้ว +3

      Learning, I can create an API with a framework but wanted to learn doing it with plain PHP.

    • @williamurquhart5169
      @williamurquhart5169 2 ปีที่แล้ว +1

      Personal project about tree varieties of all things.. whilst on break from MSc. This is great precursor to your Udemy course so thanks for posting!

    • @samuelonowuko110
      @samuelonowuko110 2 ปีที่แล้ว +1

      A learning Management System. Want a flutter developer to build the mobile version using same data.

    • @rahulbansal9580
      @rahulbansal9580 ปีที่แล้ว +2

      For learning. Thank you, Dave, for an amazing video.

  • @zzzbyyy
    @zzzbyyy ปีที่แล้ว +9

    my php back end skills are archaic ... so before I dive in any api php framework I want to learn how to do it in plain PHP ... this tutorial is a blessing for me ...

  • @manojphatak763
    @manojphatak763 10 หลายเดือนก่อน +9

    Quite simply: the best php tutorial I have seen so far! Thank you for your crystal clear explanations.

  • @collenzaligway4458
    @collenzaligway4458 2 ปีที่แล้ว +20

    I love how clearly you explain things. Please keep posting videos cause its really straight forward and help me learn a lot.

  • @GenaroDesiaCoppola
    @GenaroDesiaCoppola ปีที่แล้ว +5

    hands-down one of the best coding tutorials I've seen, thank you, this helps me a lot

  • @william254
    @william254 2 ปีที่แล้ว +8

    One of the best tutorials I've seen, including paid ones. I really appreciate it and would love to see more.

  • @NedumEze
    @NedumEze ปีที่แล้ว +3

    Come on Dave, I am still feeling dizzy watching this Video. How can you be so good! Simply no daylight between you and PHP ! Am in awe.
    Thank you so much, Dave. Sorry for myself trying to understand what you have taught so very well

  • @ferchu3226
    @ferchu3226 หลายเดือนก่อน +1

    I've been watching a lot of PHP REST API videos but none of them makes them so professional, detailed and well handled as you, thanks a lot, please make a large scale REST API project sometime or please can you reply me with a repo of some kind, thanks again!

    • @dave-hollingworth
      @dave-hollingworth  หลายเดือนก่อน

      I'm not familiar with a repo but thank you for the video idea, I'll add it to my list!

  • @chieeyeoh6204
    @chieeyeoh6204 9 หลายเดือนก่อน +1

    I came from Node and Python. Your tutorial pace very well and the content was concise, gave me the confidence to build one API server with PHP todday.

  • @med3060
    @med3060 2 ปีที่แล้ว +10

    I've been searching for such amazing lesson for so long
    thank you so much Dave .

  • @vasurupolia9481
    @vasurupolia9481 2 ปีที่แล้ว +10

    Dude, you must be a pro! Thanks for such a detailed description. I'm actually amazed why there are so less comments and likes. You deserves a million of likes and subscribers. Subscribed!😊

  • @rodrodrigues1729
    @rodrodrigues1729 ปีที่แล้ว

    Best PHP RESTful API Tutorial ever. Close the other tabs and stick to this one.

  • @ademineshat
    @ademineshat 2 ปีที่แล้ว +7

    Very nice and modern PHP Crash course. Absolutely awesome. Thanks 🙏

  • @muhammadsharif5526
    @muhammadsharif5526 ปีที่แล้ว +1

    undoubtedly, one of the best PHP API instructors... full stop... subscribed

  • @jayk4272
    @jayk4272 5 หลายเดือนก่อน +1

    thanks a lot! this is exactly what I was looking for, you explained everything really well, now I can go ahead and make my project

  • @shadrackkipkoech2075
    @shadrackkipkoech2075 2 ปีที่แล้ว +1

    The tuitorial was perfect. Very invaluable 🏆🏆🏆

  • @AhmedHuzain
    @AhmedHuzain 3 หลายเดือนก่อน

    Thanks a lot. This is genuinely one of the best tutorials I've ever watched

  • @fakh99
    @fakh99 3 หลายเดือนก่อน

    Well-explained source for learning APIs using PHP.
    Thanks for your efforts ❤

  • @dobrinivanov395
    @dobrinivanov395 4 หลายเดือนก่อน

    This is great! Perfect amount of explanation. I still have to dig in as I dont have PHP experience and this was exactly what I needed. great job!

    • @dobrinivanov395
      @dobrinivanov395 3 หลายเดือนก่อน

      Hey if you are wondering on some content, I can suggest utilising JWT access token to implement into REST API with PHP. That would be great for me, maybe other people need a tutorial on that as well as its pretty complex to grasp only from google search

  • @6962943
    @6962943 5 หลายเดือนก่อน

    YOU ARE AWESOME! I now have a better understanding of APIs in PHP

  • @johnlabuci96
    @johnlabuci96 9 หลายเดือนก่อน

    you're very good dave, you teach and introduce us to the new term like table gateway pattern and many more along the tutorial.. kudos

  • @ll18307
    @ll18307 ปีที่แล้ว

    This is just what I need, Thank you very much.
    I love how the topic is explained, very concise and straight forward.

  • @NedumEze
    @NedumEze ปีที่แล้ว

    Stunning presentation. Wow! Dave. My jaw is on the floor!
    Thanks

  • @khari_baat
    @khari_baat ปีที่แล้ว +1

    Thank you creating this wonderful video. You have helped a lot of people.

  • @royschrauwen
    @royschrauwen 2 ปีที่แล้ว +2

    Thank you very much for such a great tutorial!
    You explained everything very clearly, and the tutorial was easy to follow.

  • @chimdykekamsi
    @chimdykekamsi ปีที่แล้ว

    Great lesson, I don't normally comment but this deserves it. Thanks 📌📌📌📌📌📌✔✔✔✔✔✔👍👍

  • @andersonbandeirabbbandeira1341
    @andersonbandeirabbbandeira1341 8 หลายเดือนก่อน

    Thank you so much! Greetings from Brazil!

  • @efbYouTube
    @efbYouTube 2 ปีที่แล้ว +1

    thats it! i'm officially done w/ .net 😁 many txs dave!!!!!

  • @dagore94
    @dagore94 ปีที่แล้ว +2

    Really good video, just the one I needed.

  • @robertbinkowski
    @robertbinkowski ปีที่แล้ว +1

    This was amazing! Keep up the amazing work!

  • @ebumumin
    @ebumumin 11 หลายเดือนก่อน

    Thanks man, so educative and clear. I am developing my first API at the middle of this video 😁

  • @manmoncang
    @manmoncang 10 หลายเดือนก่อน +1

    Tq. i want to be expert at Back End as no problem at Front End. Already subscribe your modul at udemy. tq

  • @julianharder1354
    @julianharder1354 10 หลายเดือนก่อน +1

    This was very helpful, thank you!

  • @NoahNobody
    @NoahNobody ปีที่แล้ว +2

    I've started working with htmx recently and like that I don't have to work with json for the most part :)
    Still, this is a nice tutorial to set up a basic system to receive requests.

  • @lucledoux2184
    @lucledoux2184 3 หลายเดือนก่อน

    thanks very helpfull to understand the basics

  • @thiagomoretioficial
    @thiagomoretioficial ปีที่แล้ว +1

    You're really the best! Thank you so much

  • @Aalii6
    @Aalii6 ปีที่แล้ว +1

    very clear explanation, thank you!

  • @darkprogrammer9760
    @darkprogrammer9760 8 หลายเดือนก่อน

    Thank you very much for the Great Explained Video. If you can, please make another one by explaining how to upload an image / Document using the API

  • @Kolkrabe1303
    @Kolkrabe1303 ปีที่แล้ว +1

    Great Tutorial, thank you very much for your time and effort!

  • @subhasismukherjee7435
    @subhasismukherjee7435 2 ปีที่แล้ว

    Excellent Tutorial. Thanks Dave.

  • @emperoroftheearth3215
    @emperoroftheearth3215 2 ปีที่แล้ว

    Thanks.. that was very useful.. and i aslo liked your teaching style, its wonderful.. thanks again.

  • @yousef3464
    @yousef3464 ปีที่แล้ว +1

    fruitful tutorial, you are amazing

  • @rodrigoms8464
    @rodrigoms8464 ปีที่แล้ว

    excelent explication video, thanks from mexico!

  • @heshamabuzaid4293
    @heshamabuzaid4293 2 ปีที่แล้ว +1

    Thanks a lot, it was very clear.

  • @Sae-ld5bl
    @Sae-ld5bl หลายเดือนก่อน +1

    thanks for the nice video.

  • @techatival
    @techatival 11 หลายเดือนก่อน

    You are a great teacher!

  • @alalyrealestate1136
    @alalyrealestate1136 11 หลายเดือนก่อน +1

    Great as ever.. May you make a tutorial about htaccess and apache server

  • @ramsesramos2192
    @ramsesramos2192 ปีที่แล้ว

    HI Dave, this video is the best restapi creation on TH-cam, please do a video to secure the restapi with tokens or using jwt etc please please 🙏

  • @MenAmongTheRuins77
    @MenAmongTheRuins77 ปีที่แล้ว

    5 minutes in and i already learned more than from 12 hr indian courses

  • @bagusaditya4591
    @bagusaditya4591 28 วันที่ผ่านมา +1

    Nice tutor 😊

  • @GemleyStan
    @GemleyStan 6 หลายเดือนก่อน +1

    Thank you so much

  • @nihongo_
    @nihongo_ 15 วันที่ผ่านมา +1

    W great video!

  • @anantverma01
    @anantverma01 ปีที่แล้ว

    This is gold... thank you so much

  • @MartinMllerSkarbiniksPedersen
    @MartinMllerSkarbiniksPedersen 4 หลายเดือนก่อน +1

    Thanks a lot.

  • @laszlogyor6628
    @laszlogyor6628 ปีที่แล้ว

    Excellent video, thank you.

  • @warka9494
    @warka9494 ปีที่แล้ว +2

    Awesome and nicely explained tutorial, thanks Dave. by any chance can you add Authentication to this tutorial ?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว +1

      It's on my list to do when I get chance, yes!

  • @keyvanakbarzadeh
    @keyvanakbarzadeh ปีที่แล้ว

    Perfection i learned alott thank you❤

  • @aoaxe
    @aoaxe 26 วันที่ผ่านมา +1

    Thankyou sir

  • @johnlopata217
    @johnlopata217 19 วันที่ผ่านมา +1

    Lovely!
    I must ask what was that sorcery at 38:30 where you've copied l.76 and pasted but pasted values were changed to size and then to is_available😅 Am I assuming correctly that this video edition is the culprit here? 🙂

    • @dave-hollingworth
      @dave-hollingworth  18 วันที่ผ่านมา

      Yes, sorry that was done in the edit!

  • @stefanoprea6801
    @stefanoprea6801 7 หลายเดือนก่อน

    very cool vide, thanks!

  • @craigc5879
    @craigc5879 2 ปีที่แล้ว

    Absolutely awesome

  • @InspirationBroadcast
    @InspirationBroadcast 2 ปีที่แล้ว +3

    Please can you make a tutorial on the Twitter API using core PHP?

    • @dave-hollingworth
      @dave-hollingworth  2 ปีที่แล้ว

      Ok will add it to my list! Thank you for the suggestion :-)

  • @davidef.982
    @davidef.982 ปีที่แล้ว

    Great one ! Thanks a lot
    By the way, Ibought the course on Udemy !
    ... it definitively worth the money !

  • @beticohernandez9536
    @beticohernandez9536 2 ปีที่แล้ว +1

    Iras a terminar el proyecto?

  • @YoussefJassim
    @YoussefJassim 2 ปีที่แล้ว

    Thank you ! Awesome

  • @Borma425
    @Borma425 ปีที่แล้ว +1

    Wow Thanks

  • @sqdtnz
    @sqdtnz ปีที่แล้ว +1

    Very well explained. The only thing I got a little confused with was the switch case of POST/GET, and then also PATCH and DELETE, between processResourceRequest and processCollectionRequest. These are custom request methods? I guess I have missed something...

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      These are custom methods, yes. Basically the switch chooses which one to run based on the HTTP request method.

    • @sqdtnz
      @sqdtnz ปีที่แล้ว +1

      @@dave-hollingworth I have figured it out, watched it all over. This was a great tutorial, I have learned a lot in just one day. Thank you.

  • @Mescudi94
    @Mescudi94 ปีที่แล้ว +1

    Sorry again, Could I ask you which request software you are using in this video please ? Thank you very much, this tutorial is so well realized !

  • @ilya_123__
    @ilya_123__ ปีที่แล้ว

    thank you

  • @seeker3794
    @seeker3794 4 หลายเดือนก่อน

    What I hate about php tutorials, is that there is no any backend or frontend distinction and every other file is in .php extension. What about js html extensions or RESTful API?

  • @satishnotiyal3939
    @satishnotiyal3939 ปีที่แล้ว +1

    Great

  • @lukanikolic3827
    @lukanikolic3827 10 หลายเดือนก่อน

    Can someone help:
    I got this error when I want to post data form React fornt to PHP back:
    response to preflight request doesn't pass access control check it does not have http ok status

  • @PickleADC
    @PickleADC 2 ปีที่แล้ว +1

    very good tutorial about rest api. is there any way to provide the rewrite rules for nginx ?

    • @dave-hollingworth
      @dave-hollingworth  2 ปีที่แล้ว +1

      You could try something like this: winginx.com/en/htaccess

  • @DMKano87
    @DMKano87 ปีที่แล้ว

    Unfortunately I got lost somewhere in the middle. I will finish this tutorial, but at the moment it's too complicated for me ;)

  • @Uchihaze
    @Uchihaze ปีที่แล้ว

    Thanks alot for your tutorial! I have a few questions. Before even creating the database in PHPmyAdmin, my HTTPie always returns ‘404 not found’ The only files i have are index.php, .htaccess and ProductController.php in a seperate src folder & when i try to create the database in PHPmyAdmin it will not create the table. I copied your code from github and do not understand what i’m doing wrong here or how to fix it.

  • @hamzalaabidi9448
    @hamzalaabidi9448 7 หลายเดือนก่อน

    Good tutorial,
    I have a question if i want to add another another model for example user so i have to create another controller and gateway for it even configure the route
    Can you suggest a good architecture for it ?

    • @dave-hollingworth
      @dave-hollingworth  7 หลายเดือนก่อน

      I suggest using something like Slim - there's a full video on it here: th-cam.com/video/PHZtujcTRPk/w-d-xo.html

  • @ambroiseadanledji6158
    @ambroiseadanledji6158 2 ปีที่แล้ว

    Thank you Dave for this tutorial. How can I make a route for another table. Let say user for example. Thank

    • @dave-hollingworth
      @dave-hollingworth  2 ปีที่แล้ว

      You can just create more scripts that are similar to the ones in the tutorial but for a different table, e.g. create_user.php etc.

  • @amon-fanticelli1995
    @amon-fanticelli1995 ปีที่แล้ว

    those php code you wrote, are still usable nowadays or are they obsolete? nice class by the way, im a javascript/node dev, and im trying to learn php, your videos are the best i have seen so far

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      Thank you for your kind words! Yes, the code is still current and not obsolete

    • @pau1phi11ips
      @pau1phi11ips 11 หลายเดือนก่อน +1

      It's rare for old PHP to not work in the latest version. Backwards compatibility is generally very good.

  • @tornike1s
    @tornike1s 5 หลายเดือนก่อน

    Dave do you have course where you implement PHP MySQL + GraphQL for querying? or do you recomend one?

    • @dave-hollingworth
      @dave-hollingworth  4 หลายเดือนก่อน

      I'm afraid not, but it's a good idea for a video, I'll make a note of it, thank you!

  • @erenozdemir7914
    @erenozdemir7914 ปีที่แล้ว

    The course is very useful. Thanks a lot. I have a question. If we want to create another controller, such as categories. I could not understand how we should follow the actions in Index.php. Can you show a sample code snippet to create another controller?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      You'd have to create the controller class (and the gateway class if necessary) based on the URL segment, in the $parts[1] variable. A simple if-else statement would do the trick. You'd also have to modify the check for displaying a 404 status based on the URL to include another string.

  •  ปีที่แล้ว +1

    Thanks for this brilliant class! One question: why am I getting an error when I define
    array | false
    in this point: public function getUsuario(string $id): array | false
    ?
    I receive this message: syntax error, unexpected '|', expecting ';' or '{' in...
    Is there any special environment to run this way?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว +1

      That's a union type, which was introduced in PHP 8 - if you're getting an error, then you're using a version earlier than that. You can either upgrade to PHP 8, or remove those return type declarations.

  • @williameduardo7020
    @williameduardo7020 ปีที่แล้ว

    This is great content. How do you secure it?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      Using an API key is a common way (covered on the course linked to in the description)

  • @NedumEze
    @NedumEze ปีที่แล้ว

    Hi, Dave, could you consider helping with the expanded .htaccess rules?
    Secondly, could you extend this Video to add the making of a Mobile App using PHP for Server Side scripts?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      Of course, what do you want to do with the .htaccess file?

  • @BeastFish22
    @BeastFish22 ปีที่แล้ว

    In the getConnection method why do always create a new instance of a PDO?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      To connect to the database - if you're calling the getConnection method more than once in a single request, then you could modify it to always return the same object

  • @MahdiMGH
    @MahdiMGH 2 ปีที่แล้ว

    Hi Dave.
    Do you have any course about basics of this toturial? I can't undestand this toturial.
    I have also learned your two MVC courses on Udemy.

    • @dave-hollingworth
      @dave-hollingworth  2 ปีที่แล้ว +1

      Yes, there's a link at the top of the description, thank you for your interest!

  • @php-frankgp
    @php-frankgp ปีที่แล้ว

    thank

  • @TheJohcker
    @TheJohcker 2 ปีที่แล้ว +1

    Please can you make a tutorial secure php ?

    • @dave-hollingworth
      @dave-hollingworth  2 ปีที่แล้ว +2

      Ok will consider it! Thanks for the suggestion!

  • @DavidShaw-dc4re
    @DavidShaw-dc4re ปีที่แล้ว

    At @22:20 I am using HTTPie web app to do the testing and when I ran POST webserver/products name="xxx" it get a 404 status response.
    ...
    $parts = explode("/", $_SERVER['REQUEST_URI']);
    if ($parts[1] != "products") {
    http_response_code(404);
    exit();
    {
    ...
    I examined the contents of $parts[1] and it is "products%20name=%22xxx%22" What am I doing wrong? My code worked up until this point like in the video.

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      It looks like there's a query string in your URL - what is the exact HTTPie command you're using?

    • @DavidShaw-dc4re
      @DavidShaw-dc4re ปีที่แล้ว

      @@dave-hollingworth POST localhost/products name="xxx"
      I put in a a json echo of $parts[1], ignore all but "file" as they are hard coded.
      {
      "code": 404,
      "message": "Not Found",
      "file": "ncrs%20name=%22xxx%22",
      "line": ""
      }
      Ya I thought the same, about the querystring. You are using the desktop version of HTTPie? I was using the web version, is there a setting somewhere to tell it to treat /products name="xxx" as a form body rather than a querysytring? I asked because I searched the UI and didn't find anything.

    • @DavidShaw-dc4re
      @DavidShaw-dc4re ปีที่แล้ว

      Regardless moving on to your online course today, great stuff.

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      @@DavidShaw-dc4re I'm using the command-line version of HTTPie, I haven't tried the other versions yet I'm afraid

  • @lucasferreira8229
    @lucasferreira8229 ปีที่แล้ว

    what is the difference when using core/plain PHP and Laravel to create APIs?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      Laravel does a lot for you, with plain PHP you have to do it all yourself. Plain PHP is simpler though and uses less resources, but Laravel is probably faster to develop once you know the framework, so it's up to you which one you use

  • @Mescudi94
    @Mescudi94 ปีที่แล้ว

    hello, I don't get it... How did you manage to send body POST request trough URL without any function created ? It don't work when I type "localhost/product "a new product" ! 🤨

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว +1

      In what way doesn't it work? Try comparing your code to the code in the video, there's a link in the description

    • @Mescudi94
      @Mescudi94 ปีที่แล้ว +1

      @@dave-hollingworth Sorry Dave, I'm new to API. And in fact, in the video, I thought at first that when you were typing into the console your POST request , that you were typing it through a navigator URL like a $_GET, but now I 've understood :)

  • @samuelonowuko110
    @samuelonowuko110 2 ปีที่แล้ว

    Why did you choose to work in the htdocs folder directly, rather than a folder in the htdocs folder?

    • @dave-hollingworth
      @dave-hollingworth  2 ปีที่แล้ว +1

      Just to keep it as simple as possible for the video.

  • @hellotech278
    @hellotech278 2 ปีที่แล้ว +1

    😍😍😍😍

  • @johnlabuci96
    @johnlabuci96 9 หลายเดือนก่อน

    dave, on minute 22:22 i try the post request products name="new product" but the page return forbidden.. i change it to products name='new product' and now it return 404 not found.. is there any place that i need to check or any setting that i need to change? thanks

    • @dave-hollingworth
      @dave-hollingworth  9 หลายเดือนก่อน

      Are you running the code in a subfolder? If so you need to take this into account when parsing the URL for its segments

    • @johnlabuci96
      @johnlabuci96 9 หลายเดือนก่อน

      @@dave-hollingworth im using laragon and my folder structure like this dave.. www/someFolder/testApi.php

    • @johnlabuci96
      @johnlabuci96 6 หลายเดือนก่อน +1

      ​@@dave-hollingworthi completed my project by following your tutorial.. thanks man

  • @ddobren
    @ddobren ปีที่แล้ว

    Add auth etc

  • @RahulKumar-dm5zy
    @RahulKumar-dm5zy 2 ปีที่แล้ว

    I have created a rest api using codeigniter 4, now the issue is, data return from api all data is in string data type, to to get data in their original datatype, like boolean value in true/false, ids in number, names in string.

    • @dave-hollingworth
      @dave-hollingworth  2 ปีที่แล้ว

      If you connect using PDO, you can configure this by changing some PDO settings, details here: th-cam.com/video/X51KOJKrofU/w-d-xo.html

    • @RahulKumar-dm5zy
      @RahulKumar-dm5zy 2 ปีที่แล้ว +1

      @@dave-hollingworth very very thanks for your reply sir, i solved this issue with entity class provided by codeigniter 4 by casting, for example in userEntity i cast columns like this, proctected $cast =['id' =>'int', 'balance'=>'float','status'=>'bool'].

  • @ll18307
    @ll18307 ปีที่แล้ว

    Hello Dave, 23:
    Do you know why I keep getting response 403 Forbidden when I type this /products name="A new product"
    Thank you

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      What are you using to make the request? (e.g. HTTPie, cURL)

    • @ll18307
      @ll18307 ปีที่แล้ว

      @@dave-hollingworth I am using httpie desktop app

    • @ll18307
      @ll18307 ปีที่แล้ว

      @@dave-hollingworth hi, it appears that I can't put the inputs in the URL, except for the id. all other fields have to be put in the body in json instead of putting it in the url.

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      Not sure why that's happening without being able to reproduce it, but if that works for you, no problem

  • @idanportal8696
    @idanportal8696 ปีที่แล้ว

    Hi and thank you so much for this!
    I have one question though. I keep getting this error when trying to connect to the DB:
    "syntax error, unexpected 'private' (T_PRIVATE), expecting variable (T_VARIABLE)". Can't seem to find the issue.
    Do you have any idea what can it be?

    • @JCSkevin
      @JCSkevin ปีที่แล้ว

      Me too, did anyone else get and solve this?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      Don't know why I didn't see this message earlier - what line of code is causing the error?

    • @JCSkevin
      @JCSkevin ปีที่แล้ว

      @@dave-hollingworth Found the problem: If you declare a __construct function with private parameters, you get the error, so the example would be in the declaration of the Database class. The reason is that this feature of allowing private parameters was only introduced in PHP v8. So anything less than this will generate the error. Now that I know this, I used the following to get the same result.
      PHP < v8
      private string $host;
      private string $name;
      private string $user;
      private string $password;
      public function __construct( string $akahost,
      string $akaname,
      string $akauser,
      string $akapassword)
      {
      $this->host=$akahost;
      $this->name=$akaname;
      $this->user=$akauser;
      $this->password=$akapassword;
      }
      PHP > v8
      public function __construct(private string $host,
      private string $name,
      private string $user,
      private string $password)
      {}

  • @the_bwoy_programmer
    @the_bwoy_programmer ปีที่แล้ว +1

    How did you set up your Httpie. Mine is returning 404 everytime I request.

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      What URL is returning 404 for you?

    • @matrixsr172
      @matrixsr172 ปีที่แล้ว

      @@dave-hollingworth Do i need to create a products folder?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      @@matrixsr172 Depends what you're doing - why would you need a products folder?

    • @matrixsr172
      @matrixsr172 ปีที่แล้ว

      @@dave-hollingworth i am trying to do as you did. but it's showing 404 not found. in thr first segment of thhe video

    • @matrixsr172
      @matrixsr172 ปีที่แล้ว

      @@dave-hollingworth i used the same url that you used for url rewriting

  • @mongodb5166
    @mongodb5166 ปีที่แล้ว

    Is there a diff between using httpie desktop and terminal? Im using desktop version and if i try to make a POST i all time get 403 response "Forbidden
    You don't have permission to access this resource." GET Works fine but POST wont work at all.. after 2 hours trying to fix i have no clue why it won't work :/

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      There shouldn't be a difference as far as the code on the server is concerned, no - where is the 403 error coming from, your code or is the server generating it? It could be a permissions problem if you have the script in another folder

    • @fitrylol6716
      @fitrylol6716 ปีที่แล้ว

      I have similar issue right now 403 forbidden, GET work fine, have resolved the issue? if yes ,how?

  • @xanzerex1926
    @xanzerex1926 2 ปีที่แล้ว

    It is possible to make an online ordering without api?, can you please make a simple online ordering system that have database and crud

    • @dave-hollingworth
      @dave-hollingworth  2 ปีที่แล้ว

      Yes, you can have an online ordering system without an API - will add that to my list, thank you for the suggestion

    • @xanzerex1926
      @xanzerex1926 2 ปีที่แล้ว +1

      @@dave-hollingworth thank you for considering my humble request 🤩