hryha/laravel-simple-basic-auth

Basic auth for Laravel
2,183 1
Install
composer require hryha/laravel-simple-basic-auth
Latest Version:2.1.0
PHP:^8.2|^8.3|^8.4
License:MIT
Last Updated:Mar 18, 2026
Links: GitHub  ·  Packagist
Maintainer: vaniok010

Simple Basic Auth for Laravel

This package provides a middleware for Basic Auth without using a database

Latest Version on Packagist Total Downloads PHP Version Laravel Version Software License

Installation

Install the package via Composer:

composer require hryha/laravel-simple-basic-auth

Configuration

Configure the credentials by setting SIMPLE_BASIC_AUTH_CREDENTIALS in the .env file in json format

SIMPLE_BASIC_AUTH_CREDENTIALS='{"login1": "pass1", "login2": "pass2"}'

Usage

Access is allowed to all users with the correct credentials

Route::get('/')->middleware(SimpleBasicAuth::class);

Access is allowed only to user login1

Route::get('/')->middleware(SimpleBasicAuth::using(['login1']));

Testing

Run the test:

composer test

Related Packages

hryha/simple-basic-auth

Basic auth for Laravel

7,668 1
merkeleon/laravel-httpauth

Helps to lock develop version with http-auth

29,373 3
sarav/laravel-multiauth

A Simple Laravel Package for handling multiple authentication

31,350 50
phpzen/laravel-rbac

Role based access control for Laravel 5

3,236 38
tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

55,134,762 11,486

Version History

Version Released PHP Laravel License
2.1.0 ^8.2|^8.3|^8.4 ^11.0|^12.0|^13.0 MIT
2.0.0 ^8.2|^8.3|^8.4 ^11.0|^12.0 MIT