REST API with PHP and MySQL | Full Slim PHP Micro Framework Tutorial

Sdílet
Vložit
  • čas přidán 5. 06. 2024
  • In this PHP project, you'll learn how to create a REST API using the Slim micro framework.
    Please consider supporting my channel:
    ☕ ko-fi.com/davehollingworth
    Topics covered:
    • Slim basics
    • Using third-party packages in Slim
    • Dependency Injection
    • Middleware
    • Slim controllers
    • Slim configuration
    All source code shown is free to download:
    ‣ github.com/daveh/slim-rest-ap...
    Links shown in the video:
    ‣ www.slimframework.com/
    ‣ www.apachefriends.org/
    ‣ getcomposer.org/
    ‣ www.postman.com/downloads/
    ‣ httpie.io/
    ‣ www.php-fig.org/psr/psr-11/
    ‣ php-di.org/
    ‣ packagist.org
    ‣ github.com/vlucas/valitron
    Videos:
    ‣ Securely Storing PHP Configuration Settings:
    • Securely Storing PHP C...
    ‣ How to set up a virtual host in Apache (WAMP, MAMP, XAMPP)
    • How to set up a virtua...
    00:00 Introduction
    00:48 Install Slim
    02:04 Hello world
    04:29 Running Slim
    06:02 Start API
    07:17 Use API client
    07:43 Return JSON
    08:22 Get database data
    09:37 Create database class
    11:23 Autoloading
    12:32 Create repository class
    14:35 Dependency injection
    16:54 DI container entries
    19:57 Slim URL variables
    21:40 Alternative Slim routing
    22:52 Get product record
    25:55 Slim middleware
    27:13 Response middleware
    29:06 Request middleware
    31:56 Single method controllers
    34:15 Multiple method controllers
    35:44 New record endpoint
    38:03 Insert data
    40:38 Validation
    42:38 Update data endpoint
    45:18 Delete data endpoint
    46:55 Method not allowed
    47:22 Refactoring and route groups
    49:46 Summary
    #PHP #slim #project #api #restapi
  • Věda a technologie

Komentáře • 47

  • @dave-hollingworth
    @dave-hollingworth  Před měsícem +2

    Part 2, adding API key authentication is here: czcams.com/video/v5tAdjf0o3E/video.html

  • @maiwald
    @maiwald Před 2 měsíci +2

    Hey Dave, thanks for this! A very well produced and very informative video.
    I have not worked with PHP in the last 15 years or so, but with PHP hosting being dead cheap in Germany, this tutorial makes me consider going back for a small API project.

  • @stephenmitchell603
    @stephenmitchell603 Před 3 měsíci +1

    Thanks for this tutorial David. You explain concepts in simple, digestible chunks, and proceed through each topics with clarity and logic. I enjoy watching your tutorials and always come away with stronger comprehension of the subject material.

    • @dave-hollingworth
      @dave-hollingworth  Před 3 měsíci

      Thank you so much for your kind words and super thanks Stephen, I really appreciate it!

    • @truthteachers
      @truthteachers Před 3 měsíci

      For me it did not sound simple or digestible as i feel we need a good understanding of DI and Containers as a perquisite. The footprint may be small but the framework is too confusing for a solution developers like me. I would rather stick to Codeigniter and make my life simple as it provides a wholesome package. So i am unable to comment the value of the course as I feel the course is running with the assumption that we already know Slim framework.

  • @anmarm.9487
    @anmarm.9487 Před 3 měsíci +1

    I been looking for a decent tutorial on Slim... thanks

  • @gorgeouxpanjira8894
    @gorgeouxpanjira8894 Před 3 měsíci

    the best of slim framework tutorial

  • @NoahNobody
    @NoahNobody Před 3 měsíci +1

    Great choice for a tutorial.

  • @ErisPorty
    @ErisPorty Před měsícem +3

    Thank you

  • @jediampm
    @jediampm Před 3 měsíci +1

    Hi, great explanation. thanks. ;)

  • @crazyingenieur3277
    @crazyingenieur3277 Před 3 měsíci

    Excellent video!

  • @8bitcomputers_hu
    @8bitcomputers_hu Před 2 měsíci

    Thanks for this tutorial!

  • @expresscoding3525
    @expresscoding3525 Před 3 měsíci +2

    Please make a full-fledged Slim Course with a production grade API for let's say E-commerce, because Slim is a framework and provides more security, also it could be using Symfony, but a good project which is real-world would be much more useful .

  • @jackke8586
    @jackke8586 Před 18 dny

    I have already purchased three courses by Dave on Udemy.
    He is truly amazing, and the content he provides is both clear and useful.

    • @dave-hollingworth
      @dave-hollingworth  Před 18 dny

      Thank you so much for the super thanks, I really appreciate it!

  • @patrik_trejtnar
    @patrik_trejtnar Před měsícem

    thank you!

  • @evekaykay
    @evekaykay Před 3 měsíci

    Superb explanation skills. A symfony version of this would be super cool and also a deployment video on how to put all this code into azure or aws using a git repo.

  • @iam.masoudsamimi
    @iam.masoudsamimi Před 9 dny +1

    Perfectionist you are sir. Many thanks. 😇
    May I ask for a project: Full Slim CRUD with AlpineJS please?

  • @efbYouTube
    @efbYouTube Před 3 měsíci +1

    EXCELLENT as always! & txs 4 taking the time to break out the sections esp on these longer vids; makes it so much easier to later ref! love these recent vids using frameworks pckgs & libraries but have concerns on how well they will work in the shared host environments. r there web hosts that u can recommend that can accommodate them

    • @dave-hollingworth
      @dave-hollingworth  Před 3 měsíci +1

      This one in particular works well on shared hosting - this is my current recommended host: davehollingworth.com/go/hosting

    • @efbYouTube
      @efbYouTube Před 3 měsíci

      @@dave-hollingworth awesome! i'll give em a try!

  • @KGB1st
    @KGB1st Před 3 měsíci

    101 like) Good job! Perfect speech and correct explonation of the material!!! I'm starting to learn slim, and can't found better guide..
    p.s. notfoundexception returned by default already

  • @zainkhalid3670
    @zainkhalid3670 Před 3 měsíci

    Hey Dave,
    Yesterday I had to recommend a beginner level web dev course (HTML, CSS, JS, PHP, MYSQL only) to my brother.
    I was looking for a course that taught from scratch avoiding unnecessary in-depth details for beginners and yet still manage to produce a respectable project.
    I could not find a single instance on all of CZcams. Either the courses were super in depth & disjoint or too advanced.
    It'll be great if you could fill in such a course.

    • @dave-hollingworth
      @dave-hollingworth  Před 3 měsíci +1

      Ok thank you for the suggestion, I'm working on a PHP for Beginners course right now!

  • @emmanuelomotayo9177
    @emmanuelomotayo9177 Před 2 měsíci +1

    Good job! I would like you to share on how to deploy the slim restapi to a live server like heroku, Aws, azure or shared host like hostgator

  • @alalyrealestate1136
    @alalyrealestate1136 Před 3 měsíci +1

    Thnky you Dave for every thing, I already joined in two courses on udemy "php" and "mvc", and i wonder do you have advanced php course at the same quality as these? and thanks again
    👌

    • @dave-hollingworth
      @dave-hollingworth  Před 3 měsíci

      Thank you for taking my courses! I don't have an advanced course more than the PHP MVC one yet, but I'm working on it!

  • @davidsondavid4988
    @davidsondavid4988 Před 3 měsíci

    can you make an E-commerce website where u can buy with mobile, credit card, gifts, and bank accounts. Thank you.

  • @veralyons6219
    @veralyons6219 Před 3 měsíci

    Thank you for this video🎉
    Please can you make a video about why PHPMailer takes over 5 minutes to send a message ....
    Singular dynamic, plain text btw

    • @dave-hollingworth
      @dave-hollingworth  Před 3 měsíci

      It's most likely the SMTP server - SMTP servers are slow anyway, as SMTP is a "chatty" protocol. Alternatives are to use a queue and process it later, or use an email sending API

    • @veralyons6219
      @veralyons6219 Před 3 měsíci

      @@dave-hollingworth That's great, thanks

  • @dave-hollingworth
    @dave-hollingworth  Před 3 měsíci +4

    Complete API course, including authentication: davehollingworth.net/phpapisy

  • @koriehakim9188
    @koriehakim9188 Před 2 měsíci

    Promo_SM