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

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

dsdevbe/ldap-connector
======================

Easily authenticate with LDAP in Laravel

4.0.1(10y ago)968.3k20[4 issues](https://github.com/SaschaDens/ldap-connector/issues)MITPHPPHP &gt;=5.5.9

Since Apr 22Pushed 9y ago9 watchersCompare

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

READMEChangelog (8)Dependencies (3)Versions (13)Used By (0)

Not maintained anymore
======================

[](#not-maintained-anymore)

I've created this project during my internship for an easy authentication between various applications within my company. The scope of the ldap-connector was only to authenticate with Laravel to the LDAP server.

In case you're looking for a replacement please checkout [Adldap2-Laravel](https://github.com/Adldap2/Adldap2-Laravel). They have also created the awesome library [Adldap2](https://github.com/Adldap2/Adldap2) which ldap-connector was using.

I'll stop maintaining this project but would like to thank all the people that contributed or used this project.

Ldap-connector
==============

[](#ldap-connector)

[![Build Status](https://camo.githubusercontent.com/08bafa677b5f474e7d049aa1c5a4e51d6b62bb8cb0ff6613536ce22ed9e5c25a/68747470733a2f2f7472617669732d63692e6f72672f53617363686144656e732f6c6461702d636f6e6e6563746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/SaschaDens/ldap-connector)[![Latest Stable Version](https://camo.githubusercontent.com/baa83149ea595a2aeffcf0d72e297f1cb66dc9a65f03ce0aa094d63f6dc246f7/68747470733a2f2f706f7365722e707567782e6f72672f647364657662652f6c6461702d636f6e6e6563746f722f762f737461626c65)](https://packagist.org/packages/dsdevbe/ldap-connector)[![Total Downloads](https://camo.githubusercontent.com/625816f3aae5ad5013837c4ac65e19362b879f4fa4da755543d7c4260fdac26a/68747470733a2f2f706f7365722e707567782e6f72672f647364657662652f6c6461702d636f6e6e6563746f722f646f776e6c6f616473)](https://packagist.org/packages/dsdevbe/ldap-connector)[![License](https://camo.githubusercontent.com/0d5017c9b50f91394021af2a8aa103773dff49ffa9b99d258ecc579a1a03d501/68747470733a2f2f706f7365722e707567782e6f72672f647364657662652f6c6461702d636f6e6e6563746f722f6c6963656e7365)](https://packagist.org/packages/dsdevbe/ldap-connector)

Provides an solution for authentication users with LDAP for Laravel 5.x. It uses ADLDAP library on [Adldap2](https://github.com/Adldap2/Adldap2) to create a bridge between Laravel and LDAP

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

[](#installation)

- [Laravel 5.1 - 5.0](#laravel-51---50)
- [Laravel 5.2 - ...](#laravel-52---)

Laravel 5.1 - 5.0
-----------------

[](#laravel-51---50)

1. Install this package through Composer by adding the following line to `composer.json`

    ```
        "dsdevbe/ldap-connector": "3.0.*"
    ```

    or you could use command-line

    ```
    composer require "dsdevbe/ldap-connector:3.0.*"
    ```
2. Add the service provider in the app configuration by opening `config/app.php`, and add a new item to the providers array.

    ```
    Dsdevbe\LdapConnector\LdapConnectorServiceProvider::class

    ```
3. Change the authentication driver in the Laravel config to use the ldap driver. You can find this in the following file `config/auth.php`

    ```
    'driver' => 'ldap',
    ```
4. Publish a new configuration file with `php artisan vendor:publish` in the configuration folder of Laravel you will find `config/ldap.php` and modify to your needs. For more detail of the configuration you can always check on [ADLAP documentation](http://adldap.sourceforge.net/wiki/doku.php?id=documentation_configuration)

    ```
    return array(
        'plugins' => array(
            'adldap' => array(
                'account_suffix'=>  '@domain.local',
                'domain_controllers'=>  array(
                    '192.168.0.1',
                    'dc02.domain.local'
                ), // Load balancing domain controllers
                'base_dn'   =>  'DC=domain,DC=local',
                'admin_username' => 'admin', // This is required for session persistance in the application
                'admin_password' => 'yourPassword',
            ),
        ),
    );

    ```

    Please note that the fields 'admin\_username' and 'admin\_password' are required for session persistance!

### Usage

[](#usage)

The LDAP plugin is an extension of the Auth class and will act the same as normal usage with Eloquent driver.

```
if (Auth::attempt(array('username' => $username, 'password' => $password)))
{
    return Redirect::intended('dashboard');
}
```

You can find more examples on [Laravel Auth Documentation](http://laravel.com/docs/master/authentication) on using the `Auth::` function.

### Use AuthController

[](#use-authcontroller)

If you want to use the authentication controller that ships with Laravel you will need to change the following files. By default `App\Http\Controllers\Auth\AuthController` checks for the `email` field if nothing is provided. To overwrite this value add the following line in the `AuthController`.

```
protected $username = 'username';
```

Laravel documentation: [Authentication Quickstart](http://laravel.com/docs/master/authentication#authentication-quickstart)

### Ldap Groups

[](#ldap-groups)

- `Auth::user()->getGroups()` returns `array` with groups the current user belongs to.
- `Auth::user()->inGroup('GROUPNAME')` returns `boolean` if user belongs to `GROUPNAME`

### Ldap User Information

[](#ldap-user-information)

- `Auth::user()->getUsername()` returns authenticated username.
- `Auth::user()->getFirstname()` returns authenticated first name.
- `Auth::user()->getLastname()` returns authenticated last name.
- `Auth::user()->getEmail()` returns authenticated email address.

Laravel 5.2 - ...
-----------------

[](#laravel-52---)

1. Install this package through Composer by adding the following line to `composer.json`

    ```
    "dsdevbe/ldap-connector": "4.0.*"
    ```

    or you could use command-line

    ```
    composer require "dsdevbe/ldap-connector:4.0.*"
    ```
2. Add the service provider in the app configuration by opening `config/app.php`, and add a new item to the providers array.

    ```
    Dsdevbe\LdapConnector\LdapConnectorServiceProvider::class

    ```
3. Change the authentication driver in the Laravel config to use the ldap driver. You can find this in the following file `config/auth.php`

    ```
    'providers' => [
        'users' => [
            'driver' => 'ldap',
            'adldap' => [
                'account_suffix'=>  '@domain.local',
                'domain_controllers'=>  array(
                    '192.168.0.1',
                    'dc02.domain.local'
                ), // Load balancing domain controllers
                'base_dn'   =>  'DC=domain,DC=local',
                'admin_username' => 'admin', // This is required for session persistance in the application
                'admin_password' => 'yourPassword',
            ],
        ],
    ],
    ```

    Please note that the fields 'admin\_username' and 'admin\_password' are required for session persistance!

### Usage

[](#usage-1)

The LDAP plugin is an extension of the Auth class and will act the same as normal usage with Eloquent driver.

```
if (Auth::attempt(array('username' => $username, 'password' => $password)))
{
    return Redirect::intended('dashboard');
}
```

You can find more examples on [Laravel Auth Documentation](http://laravel.com/docs/master/authentication) on using the `Auth::` function.

### Use AuthController

[](#use-authcontroller-1)

If you want to use the authentication controller that ships with Laravel you will need to change the following files. By default `App\Http\Controllers\Auth\AuthController` checks for the `email` field if nothing is provided. To overwrite this value add the following line in the `AuthController`.

```
protected $username = 'username';
```

Laravel documentation: [Authentication Quickstart](http://laravel.com/docs/master/authentication#authentication-quickstart)

### Ldap User Information

[](#ldap-user-information-1)

Difference with ldap-connector V3 is that now the adLDAP model is directly exposed on the user model. This means that you can fetch all data directly from the user. To access the adldap model you can use now `Auth::user()->getAdLDAP()`.

Examples:

- `Auth::user()->getAdLDAP()->getAccountName()`
- `Auth::user()->getAdLDAP()->getFirstName()`

To fetch more properties please check [adLDAP2 documentation](https://github.com/Adldap2/Adldap2/blob/v5.2/docs/models/USER.md)

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

[](#contributing)

Feel free to contribute to this project for new features or bug fixes. We are open for improvements!

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~90 days

Recently: every ~103 days

Total

9

Last Release

3684d ago

Major Versions

1.0.0 → 2.0.02014-10-28

2.0.0 → 3.0.02015-02-06

3.1.1 → 4.0.02016-03-01

PHP version history (3 changes)1.0.0PHP &gt;=5.3.0

3.1.1PHP &gt;=5.4.0

4.0.0PHP &gt;=5.5.9

### Community

Maintainers

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

---

Top Contributors

[![SaschaDens](https://avatars.githubusercontent.com/u/6088464?v=4)](https://github.com/SaschaDens "SaschaDens (12 commits)")[![codybuell](https://avatars.githubusercontent.com/u/1231929?v=4)](https://github.com/codybuell "codybuell (2 commits)")[![andrewmillard](https://avatars.githubusercontent.com/u/8188043?v=4)](https://github.com/andrewmillard "andrewmillard (1 commits)")[![lukepolo](https://avatars.githubusercontent.com/u/2066668?v=4)](https://github.com/lukepolo "lukepolo (1 commits)")

---

Tags

laravelldap

### Embed Badge

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

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

###  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)

PHPackages © 2026

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