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(4y ago)03.9k1MITPHP

Since Apr 12Pushed 4y 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 1w 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

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

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

1531d 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

[tg/tgwebvalid

An easy way to validate Telegram Login Widget and Telegram Mini App users on your website using PHP

6827.5k1](/packages/tg-tgwebvalid)[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)[kissdigital-com/apple-sign-in-client-secret-generator

PHP package for generating 'client secret' for Sign In with Apple

2125.5k](/packages/kissdigital-com-apple-sign-in-client-secret-generator)[denniseilander/laravel-passport-scopes-restriction

Restrict scopes for different Laravel Passport clients.

1636.3k](/packages/denniseilander-laravel-passport-scopes-restriction)

PHPackages © 2026

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