socoladaica / laravel-api
2.0
2024-12-31 02:23 UTC
Requires
- socoladaica/laravel-badassium: ^2.0
- tymon/jwt-auth: ^1.0|^2.0.0
Requires (Dev)
- phpunit/phpunit: *
README
Installation
You can install the package via composer:
composer require socoladaica/laravel-api
You can publish and run the migrations with:
php artisan vendor:publish --provider="SocolaDaiCa\LaravelApi\Providers\LaravelApiServiceProvider" --tag="migrations" php artisan migrate
You can publish the config file with:
php artisan vendor:publish --provider="SocolaDaiCa\LaravelApi\Providers\LaravelApiServiceProvider" --tag="config"
Optionally, you can publish the views using
--provider="SocolaDaiCa\LaravelApi\Providers\LaravelApiServiceProvider" --tag="views"
Usage
Route::group([ 'prefix' => 'v1/admin', 'namespace' => 'Api\V1\Admin', ], function () { Route::authApi([ 'login' => true, 'reset' => false, ]); }); # create controller Auth/LoginController php artisan jwt:secret https://jwt-auth.readthedocs.io/en/develop/quick-start/ class User extends Authenticatable implements JWTSubject { public function getJWTIdentifier() { return $this->getKey(); } public function getJWTCustomClaims() { return []; } }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
MIT. Please see LICENSE File for more information.