royx0612/laravel-api-versioning is a Laravel package for laravel api 版本控制器生成工具.
It currently has 0 GitHub stars and 1.536 downloads on Packagist (latest version v1.1.4).
Install it with composer require royx0612/laravel-api-versioning.
Discover more Laravel packages by royx0612
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel Artisan command that helps you quickly scaffold versioned API components, including:
composer require royx0612/laravel-api-versioning --dev
You can publish the config file and stubs:
php artisan vendor:publish --tag=laravel-api-versioning
This will publish:
config/versioned.phpstubs/vendor/laravel-api-versioning/If you want to customize the stubs, you may modify the files inside stubs/vendor/laravel-api-versioning/ and update your config path accordingly.
php artisan make:api-controller v1 UserController --with-test --with-route --with-policy
This command will create:
App\Http\Controllers\Api\V1\UserControllerApp\Http\Requests\Api\V1\UserRequestApp\Http\Resources\Api\V1\UserResourceApp\Services\V1\UserServiceTests\Feature\Api\V1\UserTestroutes/api.phpApp\Policies\V1\UserPolicy| Option | Description |
|-----------------|---------------------------------|
| --with-test | Create a test file |
| --with-route | Append route automatically |
| --with-policy | Generate a policy file |
| --force | Overwrite existing files |
You can customize stub path in config/versioned.php:
'stub_path' => 'stubs/vendor/laravel-api-versioning',
'policy_namespace_prefix' => 'App\Policies',
MIT
Author: royx0612