intraset/laravel-basic-auth

Basic authentication using master credentials for the application.

v1.0.0 2023-10-06 16:09 UTC

This package is auto-updated.

Last update: 2024-05-06 17:24:52 UTC


README

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.