REST API with PHP and MySQL | Full Slim PHP Micro Framework Tutorial
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
Part 2, adding API key authentication is here: czcams.com/video/v5tAdjf0o3E/video.html
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.
Thank you so much for your support!
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.
Thank you so much for your kind words and super thanks Stephen, I really appreciate it!
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.
I been looking for a decent tutorial on Slim... thanks
the best of slim framework tutorial
Great choice for a tutorial.
Thank you
Hi, great explanation. thanks. ;)
Excellent video!
Thanks for this tutorial!
Thank you so much for your support!
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 .
I have already purchased three courses by Dave on Udemy.
He is truly amazing, and the content he provides is both clear and useful.
Thank you so much for the super thanks, I really appreciate it!
thank you!
Thank you so much!
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.
Perfectionist you are sir. Many thanks. 😇
May I ask for a project: Full Slim CRUD with AlpineJS please?
Thank you for the suggestion, I'll make a note of it!
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
This one in particular works well on shared hosting - this is my current recommended host: davehollingworth.com/go/hosting
@@dave-hollingworth awesome! i'll give em a try!
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
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.
Ok thank you for the suggestion, I'm working on a PHP for Beginners course right now!
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
Thanks for the idea!
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
👌
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!
can you make an E-commerce website where u can buy with mobile, credit card, gifts, and bank accounts. Thank you.
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
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
@@dave-hollingworth That's great, thanks
Complete API course, including authentication: davehollingworth.net/phpapisy
Good work
Is it up to date?
@@alalyrealestate1136 Yes
@@dave-hollingworth Is there is laravel course on udemy?
Does it include use of slim configuration setup on windows
Promo_SM