Introducing the Dingo API and JWT
1, add in the Require of Composer.json
" require " : { "dingo/api""1.0.* @dev",
"Tymon/jwt-auth" "0.5.* "
}
2. Execute composer update to introduce the newly added package
Configuring the Dingo API
1, configuration Provider
Dingo\api\provider\laravelserviceprovider::class,
2. Build configuration file for easy configuration:
PHP artisan vendor:publish--provider="dingo\api\provider\laravelserviceprovider"
The api.php configuration file is generated in the Config folder after execution, and the Dingo API configuration is complete.
Configure JWT
1, configuration Provider
Tymon\jwtauth\providers\jwtauthserviceprovider::class
2, configuration aliases
' Jwtauth ' = = Tymon\jwtauth\facades\jwtauth::class, 'jwtfactory' = = Tymon\jwtauth\facades\jwtfactory::class
3. Generate Configuration file
PHP artisan vendor:publish--provider="tymon\jwtauth\providers\jwtauthserviceprovider"
The jwt.php configuration file is generated in the Config folder after execution
4. Generate Secret Key
PHP Artisan Jwt:generate
Configuration is complete.
Laravel Configuring Dingoapi and JWT