API Versioning - How to make a Laravel CRUD API #6

preview_player
Показать описание
This tutorial talks about keeping your API backwards compatible with API versioning.

Get the code:

Follow me on social media:
Twitter: @QuentinWatt
Facebook: @quentinwatt
Instagram: @quentinwatt

Subscribe:

I also make videos here:

Donate with Paypal:
Рекомендации по теме
Комментарии
Автор

Thanks. this video is usefull. still working after 4 years. very valuable.

KenuraTech
Автор

this channel has the potential to become the best

danishmehmood
Автор

The 3 people that disliked love plain PHP. Great tutorial!

oriksgaming
Автор

Thanks! This was super useful for the Rest API I'm doing, using all of these tricks!
Wish we had more info on customizing input when creating users and such, like auto UUID and relationships with foreign id!

Zorish
Автор

Can I ask you why haven't you extended the v2 resources from v1? I mean, in some cases, the developer won't have to redo the whole apis, just some minor changes or updates, the copy pasting looks a bit messy. Just extend the original controller and override the functions with new updates or changes, sounds good?

tareqabughoush
Автор

Is there some particular reason when you made the controller you put it under Api/v1, but the Resource was just v2 instead of Api/v2? Did you have to have the "Api" folder?

TyreeArt
Автор

Great video @Quentin! Just a question: Is there a way to tackle code duplication (keep things DRY) in case we have one PersonController returning views building up a page for the website and one Api\v1\PersonController returning JSON data for consuming API by a mobile app? Because the way I see it, separating the controllers is a good thing, but then again both controllers will have common code. Thanks!

christostsangaris
Автор

Thanks for the video! It really helped to figure out a versioning strategy. One question that arise is what would be the best way to version with different Form validation request resources. One idea is to have all separated by folder version but again, DRY comes to question it. Also, looking at the controllers code, they'll be pretty similar, so duplicating them seems like a "waste". Any ideas how can I separate by version, each of them with a different Form request validation class?

jmares
Автор

I have named routes, how should I handle routes? As we can't have routes with same name. "Error: Another route has already been assigned name". Please guide

ShahZaib-dmbh
Автор

Man you realy make me work for it tho haha, while im at it why not add more rows to the table?
I already have a laravel install that was build from front to back, now i want to do it right and start with the backend.
The api route scheme i had was
Route::group(['prefix' => '/v1', 'namespace' => 'Api\V1', 'as' => 'api.'], function () {
Route::apiResource('/person', 'PersonController');
});
I just wrapped my version around it, Laravel is just that easy.


Your tutorial has been a joy so far, i just hope you stop burning my eyes in future videos (Postman is the onlything white and it BURNZZZ 🤣🤣)
Anyways i'll keep folowing the rest Thanks so far 😉

Stoney_Eagle
Автор

can i version whole app instead of just controller, like what about repository, models, etc these can also be changed depended on v1 and v2 changes, is there any way to version full app ? like laravel/v1/applaravel/v2/app, where app contains all the things like models, controllers, repositories etc

creative-commons-videos
Автор

Why not "group" the version related files together?

e.g. You have App\Http\Controller\v1 and App\Http\Resources\v1 ...

Why not App\v1\Http\Controller\... and App\v2\Http\Resources\... App\v2\Models\....

?

kendallarneaud
Автор

what if we want do lots of logic inside this function, then how to use the resource, Can generate resource collection for each function

rakeshkv