PHPackages                             owenmelbz/basic-auth-enforcement - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. owenmelbz/basic-auth-enforcement

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

owenmelbz/basic-auth-enforcement
================================

Laravel 5+ Middleware to enforce basic auth on your application code.

0.0.7(6y ago)15.0k2MITPHP

Since May 26Pushed 6y agoCompare

[ Source](https://github.com/OwenMelbz/basic-auth-enforcement)[ Packagist](https://packagist.org/packages/owenmelbz/basic-auth-enforcement)[ RSS](/packages/owenmelbz-basic-auth-enforcement/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (8)Used By (0)

Laravel 5+ Basic Auth Enforcement
=================================

[](#laravel-5-basic-auth-enforcement)

An automatic piece of middleware for Laravel 5+, will prompt users accessing your code base (static assets are excempt) to enter a username/password before seeing your application. Very useful for things like staging environments.

Usage
-----

[](#usage)

1. Install via composer `composer require owenmelbz/basic-auth-enforcement`
2. Register the service provider - typically done inside the `app.php` providers array e.g `OwenMelbz\BasicAuthEnforcement\BasicAuthEnforcementServiceProvider::class`
3. Add `ENFORCE_BASIC_AUTH=true` to your application environment config e.g `.env`
4. Add your username `BASIC_AUTH_USER=username`
5. Add your password `BASIC_AUTH_PASSWORD=password`
6. Enjoy your stress free environment agnostic basic auth.

Configuration
-------------

[](#configuration)

You can public the config using `php artisan vendor:publish --provider="OwenMelbz\BasicAuthEnforcement\BasicAuthEnforcementServiceProvider"` which will allow you to exclude IPs from the checks as well as custom endpoints, which is useful for payment gateway ping backs etc.

Why?
----

[](#why)

Too often we've wasted time configuring password protection, with proxy systems like CloudFlare, with apache development machines and nginx production, this removes all the headache and can simply be turned off and on at a whim.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~143 days

Recently: every ~214 days

Total

7

Last Release

2420d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/672fbfa799365c6b8e334b066ad674e06ed4c6d68536ad2fe9be3bd565b5c601?d=identicon)[OwenMelbz](/maintainers/OwenMelbz)

---

Top Contributors

[![OwenMelbz](https://avatars.githubusercontent.com/u/1094740?v=4)](https://github.com/OwenMelbz "OwenMelbz (10 commits)")

---

Tags

basic-authenticationlaravel-5-packagephplaravelbasic authentication

### Embed Badge

![Health badge](/badges/owenmelbz-basic-auth-enforcement/health.svg)

```
[![Health](https://phpackages.com/badges/owenmelbz-basic-auth-enforcement/health.svg)](https://phpackages.com/packages/owenmelbz-basic-auth-enforcement)
```

###  Alternatives

[imdhemy/laravel-purchases

The top-notch Laravel receipt validator.

3831.1M2](/packages/imdhemy-laravel-purchases)[martbock/laravel-diceware

Diceware Passphrase Generator for Laravel

3264.7k](/packages/martbock-laravel-diceware)[orchestra/auth

Auth Component for Orchestra Platform

24108.5k3](/packages/orchestra-auth)[ingria/laravel-x509-auth

Laravel 5 Client Certificate auth middleware

375.6k](/packages/ingria-laravel-x509-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
