Build a RESTFUL API with SlimPHP
HTML-код
- Опубликовано: 4 мар 2021
- Learn how to create an API with SLIM PHP!
PHP Hosting: www.cloudways.com/en/php-host...
Cloudways offers peace of mind and flexibility so you can focus on growing your business and reaching new milestones instead of dealing with server management. With Cloudways, you get an optimized stack, managed servers, backups, staging environment, integrated Git, pre-configured, Composer, 24/7 support, and the choice of five cloud providers: AWS, DigitalOcean, Linode, Google Cloud, and Vultr
Get up to 1 Month Free Hosting by using code "TYLERP" and get $15 free hosting credit.
// Support me on Ko-Fi
ko-fi.com/tylerpotts
// FOLLOW ME ON TWITTER
/ tyler_potts_
// MY GEAR FOR CODING AND RUclips
Blue Yeti Microphone: amzn.to/3jr3l7T
Microphone Stand: amzn.to/35B9LMN
Chair: amzn.to/3dWds3F
Thunderbolt Dock: amzn.to/3osBF6u
Monitor: amzn.to/37I8KoR
All of these products I own and have tested!
// INTERESTED IN GAME DEV?
Game development channel: / muddywolf
// CHECK OUT MY GAME
play.google.com/store/apps/de...
// DO THESE SIMPLE STEPS
LIKE, SUBSCRIBE & SHARE - Хобби
Issues here with SQL injection, please use bind params anytime you need to pass anything into the SQL statement. Also REST does not use RPC, it has routes which uses the HTTP method to determine the function, e.g. POST /friends rather than POST /friends/add.
It was short, simple and enough to understand. Thank you so much Tyler.
It's a great job! Thank you, Tyler!
I was looking for the proper tutorial and thanks to God I've found yours!
Glad I could help!
thanks so much I wanted to try this Slim in my app ... and this tutorial is perfect starter for me.
Thank you so much for this clear and precious Explanation.
You're very welcome!
Super useful walk-through and tutorial
Hi Tyler, great video. Learned more about REST API and using Slim to develop them. I would like to know what's next step/phase....I'm thinking of how to clean inputs and also inlcude authentication/authorization in using the api. Any recommendation where I can learn these?
Thanks again.
Great tutorial, thanks! You have the same voice as Shaun of "The Net Ninja" channel.
Thanks I just had doubts about making a simple API with Slimm instead of with lumen
Great vid! Thanks Tyler!
Glad you liked it!
Microframeworks are great, some developers don't even know how to write a database query nowadays, and then no one knows how to fix it if something goes wrong.
Simply and easy , thanks alot.
You are welcome 😊
In index.php I have multiple require __DIR__ ./../routes/filename.php
But always only the last one works. Is there a solution to multiple API endpoints?
it doesn't work using router "require" on my part... Is this video for slim3 or slim4?
Is there a reason why there are no controllers in this app?
Thanks for the tutorial!.. I just had a question.. what if I wanted to put new data or update the data that is in the database?
I think new data was described around the code $app->post ----
Thanks
what about put?
Authentication?
This was a useful video, Tyler. Thanks!
i got an error by request localhost/name
You don't have permission to access this resource. # i hav not middleware activated .
the first Request localhost/ work fine.
Thanks, Andreas. If you need more help feel free to join my discord and ask for help in the channels :D
This is not Tyler, this is Judo Sloth due to his speech manner)
I watched the start of the video. I liked it.
Then I saw blank requires instead of PSR autoloading and it kinda flattened.
Hi @tylerPotts. Thanks for this vidéo. I'm trying to make this work on SLIM4. It works fo-ine for the 2x GET and DELETE. Unfortunately the POST isn't working. Array pushed to the DB is always NULL. When making a var_dump of the $request, array is simply NULL. As a consequence, it creates the line in the DB but content is called "ARRAY". Any idea.
The hosting u promoted is expensive af
I'm currently using it myself, although it is more expensive than its competition it offers great managed hosting on a cloud platform.
i got an error : Uncaught Slim\Exception\HttpNotFoundException: Not found.
I got that same error too.
You guys got a solution for this?
Try to change your directory like this.
$app->get('/project-folder/public/', function (Request $request, Response $response) {
$response->getBody()->write("Hello, World!");
return $response;
});
@@Aqrza thanks
Wow, the documentation for this is so poor that not even ChatGPT can help me. I'm sorry, but I'm uncertain if this project can be taken seriously.