PHPackages                             rickselby/laravel-external-basic-auth - 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. rickselby/laravel-external-basic-auth

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

rickselby/laravel-external-basic-auth
=====================================

External Basic Auth for Laravel

1.8.0(2y ago)25.7k↑33.3%MITPHPPHP 8.\*CI passing

Since Dec 1Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/rickselby/laravel-external-basic-auth)[ Packagist](https://packagist.org/packages/rickselby/laravel-external-basic-auth)[ RSS](/packages/rickselby-laravel-external-basic-auth/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (11)Used By (0)

Laravel External Basic Auth
===========================

[](#laravel-external-basic-auth)

[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/82d078b648b88c093943e053f70b42c5e4b0312d45bcf75787e34fa87b3c76bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7269636b73656c62792f6c61726176656c2d65787465726e616c2d62617369632d61757468)](https://camo.githubusercontent.com/82d078b648b88c093943e053f70b42c5e4b0312d45bcf75787e34fa87b3c76bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7269636b73656c62792f6c61726176656c2d65787465726e616c2d62617369632d61757468)

This is a guard for Laravel that assumes the value in `$_SERVER['REMOTE_USER']`is the identifier for the currently logged in user.

Laravel's built-in basic auth still auths the username and passwords against the `users` table, which in our case will not contain their password.

Usage
-----

[](#usage)

```
composer require rickselby/laravel-external-basic-auth

```

Then, edit your `config/auth.php` file, and under `guards`, set the appropriate driver to `external`; e.g.

```
'guards' => [
    'web' => [
        'driver' => 'external',
        'provider' => 'users',
    ],
],

```

Alternate lookup field
----------------------

[](#alternate-lookup-field)

By default, the package will match the `$_SERVER['REMOTE_USER']` value against the `id` of the user model. If the `$_SERVER['REMOTE_USER']` value is in a different field (e.g. the user model has a standard auto-incrementable integer for an ID, and a separate `username` field) then the package can look up a user by this field instead.

Edit your `config/auth.php` file, and under the appropriate `guard`, add a `field` setting:

```
'guards' => [
    'web' => [
        'driver' => 'external',
        'provider' => 'users',
        'field' => 'username',
    ],
],

```

Eager load relationships
------------------------

[](#eager-load-relationships)

It may be desirable to eager load relationships for the authenticated user.

Edit your `config/auth.php` file, and under the appropriate `guard`, add a `load` setting:

```
'guards' => [
    'web' => [
        'driver' => 'external',
        'provider' => 'users',
        'load' => [
            'permissions',
            'roles',
        ],
    ],
],

```

Looking for REMOTE\_USER in headers
-----------------------------------

[](#looking-for-remote_user-in-headers)

If your app is running in a docker container, or some other situation where your app is separated from the authentication, it may be desirable to pass the `REMOTE_USER` to the app by headers.

Edit your `config/auth.php` file, and under the appropriate `guard`, add a `header` setting:

```
'guards' => [
    'web' => [
        'driver' => 'external',
        'provider' => 'users',
        'header' => 'X-forwarded-REMOTE_USER',
    ],
],

```

Stripping a string from the user identifier
-------------------------------------------

[](#stripping-a-string-from-the-user-identifier)

If your authentication field has a part you do not wish to use (e.g. ), this can be stripped:

```
'guards' => [
    'web' => [
        'driver' => 'external',
        'provider' => 'users',
        'strip' => '@domain.com',
    ],
],

```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance48

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 91.1% 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 ~214 days

Recently: every ~131 days

Total

10

Last Release

796d ago

PHP version history (5 changes)1.0PHP &gt;=7.0

1.2PHP &gt;=7.3

1.3.1PHP ^7.3|^8.0.0

1.5.0PHP ^7.3|^8.0

1.7.0PHP 8.\*

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cc8910980f053d8ceb2e9d938427cf03ae509884763a10f916b4eef5591934f?d=identicon)[rickselby](/maintainers/rickselby)

---

Top Contributors

[![rickselby](https://avatars.githubusercontent.com/u/1564517?v=4)](https://github.com/rickselby "rickselby (51 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")

---

Tags

laravelauthbasicexternal

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rickselby-laravel-external-basic-auth/health.svg)

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

###  Alternatives

[lab404/laravel-impersonate

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

2.3k16.4M48](/packages/lab404-laravel-impersonate)[codegreencreative/laravel-samlidp

Make your PHP Laravel application an Identification Provider using SAML 2.0. This package allows you to implement your own Identification Provider (idP) using the SAML 2.0 standard to be used with supporting SAML 2.0 Service Providers (SP).

263763.5k1](/packages/codegreencreative-laravel-samlidp)[pallant/laravel-aws-cognito-auth

An authentication driver for Laravel for authenticating users in AWS Cognito User Pools

777.7k](/packages/pallant-laravel-aws-cognito-auth)

PHPackages © 2026

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