Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Versioning your API: from V1 to V2 and Beyond

Premium
5:00

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

TG
Thananjeyan G ✓ Link copied!

Hi Polvis,

I recently upgrade a premium member. I mostly wanted API things.

For Versioning API demo videos are built with old version of Laravel.

Now I am using Laravel 8 or 9.

I couldnt see showed methods MapapiRoutes and Change namespace etc. ?

How can i do that in Laravel 9?

Thanks Thananjeyan !

PK
Povilas Korop ✓ Link copied!

The mapApiRoutes method was my own method, it doesn't come from Laravel. I don't remember that exact course, but currently in Laravel 9 take a look at Laravel RouteServiceProvider and make the changes you need in $this->routes() method: https://github.com/laravel/laravel/blob/9.x/app/Providers/RouteServiceProvider.php

SP
Sylvain P ✓ Link copied!

I suppose both version should have same database, and can't improve without broken

HL
Homby Lin ✓ Link copied!

Hi, Povilas, Should mapApiV2Routes() in the example be base_path('routes/api_v2.php') for it to be correct? (At 3:50 in the video)

M
Modestas ✓ Link copied!

Yes