简体   繁体   中英

Implement Laravel API Routes with versioning

I want to make an API for my project

i can make something like:

/api/something

basically adding routes in /routes/api.php

But i want to make versioning like:

/api/v1/something

So i want to know how to group all api routes for v1, v2 and so on.

Write all your route inside a prefix named v1:

Route::group(["prefix" => "v1"], function () {
//Write your routes here
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM