Let's Build an API using Slim PHP Framework

preview_player
Показать описание
This video shows you how to build an API using the Slim PHP microframework. The API allows you to add, delete, modify, and fetch the details of cricket players via JSON HTTP requests. We'll also implement data validation, authentication, and error handling using middlewares.

0:00 Intro
1:53 Installing Composer
8:38 Setting up the server
16:13 Installing Postman
17:50 Adding Routes
19:18 Connecting to the Database
22:25 Routes continued...
23:22 Using DBAL for Database Queries
27:42 Understanding Dependency Injection
31:03 Route to get all players
32:22 Route to get a single player
34:50 Route to add a new player
35:33 Getting input data using Body Parser Middleware
41:41 Route to update a player
44:23 Route to delete a player
45:43 Authentication
54:40 Request data validation
1:01:05 Handling Errors
1:03:10 Storing credentials in dotenv file
1:05:51 Final Notes

---------------------------------------

Server providers:
-------------------------------------------------------------

Disclaimer:

This video is based on my personal experiences and knowledge. There is no guarantee that the information shared is 100% accurate.

Disclosure:

This video and its description may contain affiliate links, which can earn us commission if someone purchases products using those links.
Рекомендации по теме
Комментарии
Автор

gracias por compartir, explicas bastante bien 👍

kevinillu
Автор

I get error name to resolved. I am running it in WSL so maybe thats the issue

Tengil
Автор

Thank you for the video. You did explain things very well. Now it is time to try to build a REST API myself. One question came to mind directly. Is it not possible to use the env file for the error handling settings?

sandervanderwindt
Автор

in Error Handling section, showing an html output of an error is not a good use. that should be json formatted error response...

kingnothingfpv
Автор

Great tutorial thank you for this.
Please I am getting this error from the public/index.php:

Fatal error: Uncaught TypeError: Argument 1 passed to must be an instance of Psr\Container\ContainerInterface, instance of DI\Container given

tobianointing
Автор

Thanks for the video. There is only one thing I didn't understand: how is it possible to do $this->get('DB') in the api.php file to get the queryBuilder since you are not in a class and therefore there are no properties? Thank you

smark
visit shbcf.ru