PHPackages                             uogsoe/ldap-laravel - 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. uogsoe/ldap-laravel

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

uogsoe/ldap-laravel
===================

Adds a custom auth provider for our LDAP service

4.0.0(3y ago)03.8k1MITPHP

Since Apr 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/UoGSoE/LaravelLdap)[ Packagist](https://packagist.org/packages/uogsoe/ldap-laravel)[ RSS](/packages/uogsoe-ldap-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (9)Used By (1)

Mixed LDAP/Eloquent user provider for Laravel
=============================================

[](#mixed-ldapeloquent-user-provider-for-laravel)

WIP! Do not use!

This adds an 'ldapusers' provider to the Laravel auth scheme. This is for our own particular needs and works the way we generally use our local LDAP service.

It does :

- If the user logs in with a username &amp; password found in the users table - they are logged in as per a default laravel app. This is to support 'external' users not in our LDAP system.
- Otherwise, if we find the username in LDAP we try and look up their details, create a local record for them in the 'users' table and (assuming their password is ok) log them in.

Usage
-----

[](#usage)

In your `config/auth.php` file add the new provider and change 'users' to 'ldapusers' in the default web guard :

```
...
    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'ldapusers',
            // originally 'provider' => 'users'
        ],
    ...
    'providers' => [
        ...
        'ldapusers' => [
            'driver' => 'ldapeloquent',
            'model' => App\User::class,
        ],
    ]

```

And you need to add the following to app\\Http\\Controllers\\Auth\\LoginController.php (assumes you've run `artisan make:auth`) :

```
    public function username()
    {
        return 'username';
    }

```

You need to set two ENV variables in your .env file :

```
LDAP_SERVER=your.ldap.server
LDAP_OU=your-base-ou

```

eg :

```
LDAP_SERVER=ldap.yourcompany.com
LDAP_OU=Staff

```

Assumptions
-----------

[](#assumptions)

We assume your user model is in the default `App\User` class. We also expect the `users` table to have the following fields :

```
username (string) - the primary username to look up (rather than 'email')
email (string) - the users email address
surname (string) - the users surname
forenames (string) - the users forenames
is_staff (boolean) - whether the user is a member of staff or not

```

Tests
-----

[](#tests)

There aren't any tests in this repo itself as it was a bit of a pain to write them without the full framework being available. So there is a test app at  which pulls this package in and checks it seems to work ok.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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 ~217 days

Recently: every ~178 days

Total

8

Last Release

1432d ago

Major Versions

1.0.2 → 2.0.02020-06-29

2.0.1 → 3.0.02020-10-19

3.0.1 → 4.0.02022-06-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/5472be37b2cbedfa6c905bb674cb5780378cf2adcfc47befe01ad7bb4d14f734?d=identicon)[ohnotnow](/maintainers/ohnotnow)

---

Top Contributors

[![ohnotnow](https://avatars.githubusercontent.com/u/6471843?v=4)](https://github.com/ohnotnow "ohnotnow (18 commits)")

### Embed Badge

![Health badge](/badges/uogsoe-ldap-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/uogsoe-ldap-laravel/health.svg)](https://phpackages.com/packages/uogsoe-ldap-laravel)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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