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

Опубликовано: 11 Февраль 2024
на канале: Dave Hollingworth
14,197
417

In this PHP project, you'll learn how to create a REST API using the Slim micro framework.

Please consider supporting my channel:
☕ https://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:
‣ https://github.com/daveh/slim-rest-ap...

Links shown in the video:
‣ https://www.slimframework.com/
‣ https://www.apachefriends.org/
‣ https://getcomposer.org/
‣ https://www.postman.com/downloads/
‣ https://httpie.io/
‣ https://www.php-fig.org/psr/psr-11/
‣ https://php-di.org/
‣ https://packagist.org
‣ https://github.com/vlucas/valitron

Videos:
‣ Securely Storing PHP Configuration Settings:
   • Securely Storing PHP Configuration Se...  

‣ How to set up a virtual host in Apache (WAMP, MAMP, XAMPP)
   • How to set up a virtual host in Apach...  

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