voyager-inc / basic-auth
Basic auth
dev-main
2024-05-10 08:08 UTC
Requires
- php: ^8.2
- illuminate/support: ^11.0
Requires (Dev)
- orchestra/testbench: ^4|^5|^6|^7|^8|^9
This package is auto-updated.
Last update: 2024-05-10 08:08:56 UTC
README
Installation
composer require voyager-inc/basic-auth
- Publish provider
php artisan vendor:publish --provider="VoyagerInc\BasicAuth\ServiceProvider"
Usage
- We have new middleware with the aliases
basic-auth
return [ 'enabled' => env('BASIC_AUTH_ENABLED', true), // 'true' to enable, 'false' to disable 'username' => 'admin', // config username 'password' => 'password', // config password 'error_message' => 'Unauthorized', // custom error message 'headers' => [ // config headers 'WWW-Authenticate' => 'Basic realm="Sample Private Page"', 'Content-Type' => 'text/plain; charset=utf-8' ], ];
- Example
Route::get('/test', function () { return 'basic auth route'; })->middleware(['basic-auth']);