hryha/laravel-simple-basic-auth

Basic auth for Laravel
2,106 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,641 1
merkeleon/laravel-httpauth

Helps to lock develop version with http-auth

29,372 3
tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

54,298,365 11,494
lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users...

20,848,025 2,344
kodeine/laravel-acl

Light-weight role-based permissions for Laravel 5 built in Auth system.

364,261 774