Looking to hire Laravel developers? Try LaraJobs

laravel-basic-auth maintained by intraset

Description
Basic authentication using master credentials for the application.
Last update
2023/10/06 18:09 (dev-dev)
License
Downloads
84
Tags

Comments
comments powered by Disqus

Laravel Basic Auth

Latest Version on Packagist MIT Licensed Total Downloads

Basic authentication using master credentials for the application.

Installation

composer require intraset/laravel-basic-auth

Configuration

Publish the configuration file:

php artisan vendor:publish --provider="Intraset\LaravelBasicAuth\ServiceProvider"

Usage

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

Middleware

The middleware can be used in the following ways:

Route::get('/', function () {
    //
})->middleware('basic.auth');

Testing

composer test

Credits

License

The MIT License (MIT). Please see License File for more information.