laravel application generate route file by annotation
composer require phpone/laravel-annontation-route
- add RouteAnnotationProviders to config/app.php
<?php
return [
'providers' => [
//.......other serviceProvider
\PhpOne\LaravelAnnotation\Providers\RouteAnnotationProviders::class,
]
];
- generate route file by command
php artisan annotation-route:generate
this function will scan Annotations of Controller dir , and wirte into api.php the file like this
<?php
Route::post("api/user/login","UserController@login");
Route::get("api/company/info","CompanyController@info");
- @Controller
- @Mapping
- @PostMapping
- @GetMapping
- @Group