Basic authentication using master credentials for the application.
composer require intraset/laravel-basic-auth
Publish the configuration file:
php artisan vendor:publish --provider="Intraset\LaravelBasicAuth\ServiceProvider"
Activate the middleware in the .env file:
BASIC_AUTH_ENABLED=true
Set the master credentials in the .env file:
BASIC_AUTH_USERNAME=admin
BASIC_AUTH_PASSWORD=secret
Change the middleware alias in the .env file:
BASIC_AUTH_ALIAS=basic.auth
Change the middleware behavior to be applied to the application globally in the .env file:
BASIC_AUTH_GLOBAL=true
Change the middleware behavior to be applied to the middleware group in the .env file:
BASIC_AUTH_GROUP=web
The middleware can be used in the following ways:
Route::get('/', function () {
//
})->middleware('basic.auth');
composer test
The MIT License (MIT). Please see License File for more information.