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

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

tyler36/ldap
============

Authenticate in Laravel via LDAP

1.0.1(7mo ago)0377mitPHP

Since Mar 3Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/tyler36/ldap)[ Packagist](https://packagist.org/packages/tyler36/ldap)[ Docs](https://github.com/tyler36/ldap)[ RSS](/packages/tyler36-ldap/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (2)Dependencies (5)Versions (6)Used By (0)

Ldap
====

[](#ldap)

[![Latest Version on Packagist](https://camo.githubusercontent.com/53b6a4084d16699b7d7995863b19d1dc46b207288ba6ad8b698bd7f9abdaa4a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74796c657233362f6c6461702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tyler36/ldap)[![Total Downloads](https://camo.githubusercontent.com/93ce11fc35d02ec89d84067e46b6c77bd78dec4918e5fcf93d02567e35d6fe56/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74796c657233362f6c6461702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tyler36/ldap)[![Build Status](https://camo.githubusercontent.com/6f28fadfe316fd81ceaad5ba09913a145b9a0e5ecb0e8809d3e763bf05c1e077/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f74796c657233362f6c6461702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tyler36/ldap)[![StyleCI](https://camo.githubusercontent.com/cb13a877afd1dbe223c631789c3f922d3ace958fdb334a9cce9b26afefbc2ebd/68747470733a2f2f7374796c6563692e696f2f7265706f732f31323334353637382f736869656c64)](https://styleci.io/repos/12345678)

This package is designed to offer a quick authentication process via LDAP. The example below describes a setup that authenticates using a `username` and ```password`` combination.

Installation
------------

[](#installation)

Via Composer

```
$ composer require tyler36/ldap
```

Usage
-----

[](#usage)

1. Publish the config file

```
$ php artisan vendor:publish --provider="Tyler36\Ldap\LdapServiceProvider"
```

2. Update `.ENV` with server settings

```
LDAP_HOST=
LDAP_USERNAME=
LDAP_USERNAME_PREFIX=
LDAP_FILTER=
LDAP_DOMAIN_COMP=
LDAP_COMMON_NAME=
LDAP_BASE_DN=

```

3. Add a username column to your user migration.

```
$table->string('username')->unique();

```

4. Update login view by replacing `email` with `username`. Remember to remove the `type="email"`

```

```

### Laravel 7

[](#laravel-7)

5. Update your `LoginController` file. Remember to import `Tyler36\Ldap\LdapAuthenticator;`

```
/**
  * Get the login username to be used by the controller. ['email']
  *
  * @return string
  */
public function username()
{
    return config('ldap.username');
}

/**
 * Attempt to log the user into the application.
 *
 * @param \Illuminate\Http\Request $request
 *
 * @return mixed
 */
protected function attemptLogin(Request $request)
{
    // This is where authentication happens. It SHOULD return an array containing the user
    $ldap     = new LdapAuthenticator($request);
    $ldapUser = $ldap->authenticate();
    if (!$ldapUser || 'array' !== gettype($ldapUser)) {
        return $ldapUser;
    }

    // Un-comment the following to see details of the user array
    // dd($ldapUser)

    // Update or create a new user based on the username. The second array determines how to populate new users.
    $user   = User::updateOrCreate(
        [$this->username() => $request->get('username')],
        [
            $this->username() => $request->get('username'),
            'name'            => optional($ldapUser)['displayname'][0],
            'email'           => optional($ldapUser)['mail'][0],
        ]
    );

    auth()->login($user);
}
```

### laravel/breeze

[](#laravelbreeze)

- Replace the rules section in `app/Http/Requests/Auth/LoginRequest.php`.

```
    public function rules()
    {
        return config('ldap.rules');
    }
```

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits
-------

[](#credits)

- [author name](https://github.com/tyler36)
- [All Contributors](../../contributors)

License
-------

[](#license)

license. Please see the [license file](license.md) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance63

Regular maintenance activity

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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

Total

4

Last Release

223d ago

Major Versions

0.2 → 1.02021-04-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/c68f48588d57835c170cde02444307a450b98cfab07c9674094b881545c13b76?d=identicon)[tyler36](/maintainers/tyler36)

---

Top Contributors

[![tyler36](https://avatars.githubusercontent.com/u/7234392?v=4)](https://github.com/tyler36 "tyler36 (6 commits)")

---

Tags

authenticationlaravelldaplaravelldap

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[directorytree/ldaprecord-laravel

LDAP Authentication &amp; Management for Laravel.

5682.0M15](/packages/directorytree-ldaprecord-laravel)[pschocke/laravel-telegram-login-widget

Easily integrate Telegrams login widget into your Laravel application to send Telegram messages

1610.4k](/packages/pschocke-laravel-telegram-login-widget)

PHPackages © 2026

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