I just realized that RouteServiceProvider is not available in the framework. What is the reason? Or what is the alternative to inject a new route.php file in the ServiceProvider?
The idea is you just write your own service provider. That should be pretty trivial to do. ;)
Hey @GrahamCampbell, I asked that because I am referring to the project Lumen.
Yes, Laravel seems to be pretty trivial since we have a class Illuminate\Foundation\Support\Providers\RouteServiceProvider that does all of the cache work and everything. Basically it's just a matter of extending from RouteServiceProvider and overriding the method called map.
So, since we don't have Illuminate\Foundation\Support\Providers\RouteServiceProvider into Lumen project, I am just wondering if I will need to recreate the same class in order to have the same behavior. Thanks.
I know this is closed, but it is also the top google result when I googled for this. I would like to re-ask @jairobjunior's question.
Do we need to recreate our own Illuminate\Foundation\Support\Providers\RouteServiceProvider since it is not available in lumen?
You dont need to re-create RouteServiceProvider, you can define your route groups inside the bootstrap/app.php , something like this incase u don't want use default web route
$app->router->group([
'namespace' => 'App\Http\Controllers',
'prefix' => 'v1',
], function ($router) {
require __DIR__.'/../routes/api-v1.php';
});
Most helpful comment
You dont need to re-create RouteServiceProvider, you can define your route groups inside the bootstrap/app.php , something like this incase u don't want use default web route