One of the most important but overlooked things is to document your API for future clients, whether they would come from a JS front-end, or a mobile app. Things like:
- Endpoints
- Parameters
- Auth mechanism
- Example responses
Luckily, there are a few Laravel packages that allow you to generate such docs automatically. You configure things you need, by modifying the config file and adding some comments to your routes/controllers, then you run an Artisan command, and it saves the static HTML files to a public folder on your server. As a result, you can just send the link to it, to your API consumers.
My personal favorite package for this is called Scribe, and we will use exactly that one.
Thanks Povilas, very good resource!! Let's go for the second part? like Front-ent integration or payment? haha keep the good job!
I second the frontend integration!
Front-end integration tutorials for Vue and React are already in progress, for February :)
im excited for the front-end integration! thanks Povilas!
I will try to be as active as Andy in the comments too :) Look forward to the frontend integration - i'm doing a frontend integration in Vue now so it will be good to compare my 'attempt' to yours (your frontend will be a 100x better I am sure lol)
@Gavin I'm not a front-ender at all, so I wouldn't fully count on my implementation being better :)
Thank you! Very nice tutorial!
Still debugging this - however when I run the
php artisan scribe:generatecommand I get the following error, anyone else had the same problem? P.S I added the @group <Controller> code to each controllerOutput from VS Code
Weirdly - I cloned your copy of the Laravel car parking app from github and ran the scribe command and it works fine... so there is something weird with mine i'll try to dig more into it over the weekend
Yeah, again, I can't debug what I haven't encountered myself. Let us all know if you find the difference. That's, by the way, the downside of all those auto-generating tools: you need to be precisely careful with how your docblocks are written.
I'm not so fussed with the error above as I can always use your original repo, but I have gained a lot of insight especially with the phpunit tests! Thanks I really enjoyed this one a lot :)
Well, I didn't plan the hightlight of this course to be the TESTING lesson, added it as a bonus mostly, but... whatever works! :)
Very good course
Thanks Ali!
Thank you for the course. I love writing clean code and the course reflects that. So, i have a question, I want to create laravel api and apply authorization. i discovered sanctum from this course and confused for authorization. I used to spatie laravel permission package for authorization. But there is a similar option in sanctum which is abilities. So i want to ask that or please give me advice for this, what should i use for authorization? or what do u use for authorization?
Personally, I've never used Sanctum abilities, only spatie/laravel-permission. I'm not sure if those abilities would work the same, I'm just used to the package that I've been using for years now.
Awesome course :) Thank you.
Thank you Povilas.
Thank you Povilas, awesome course
Thank you, this is good course!
Are you forget @group Auth in LogoutController?
Yes, good point, forgot about that, but now too much work to change and re-do the screenshots :)
Hello and thanks for the course. I have a question altho regarding "response_calls", did it change name because i cant find it.
Thanks for recommendation for Scribe to produce API documents. I was looking for a more automated solution. You do a great job of pointing us in the right direction with your examples and how to...