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

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

t3chn0crat/laravel-ldap-connector
=================================

Authenticate with and fecth data from LDAP in Laravel

0.2-Alpha(10y ago)2143MITPHPPHP &gt;=5.3.0

Since May 22Pushed 10y ago2 watchersCompare

[ Source](https://github.com/T3chn0crat/laravel-ldap-connector)[ Packagist](https://packagist.org/packages/t3chn0crat/laravel-ldap-connector)[ Docs](https://github.com/t3chn0crat/laravel-ldap-connector)[ RSS](/packages/t3chn0crat-laravel-ldap-connector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

[![travis build](https://camo.githubusercontent.com/92d0f5bd0c3d319719c4061231bf5d9c5df280ef42d2069a2d3684385830c04a/68747470733a2f2f7472617669732d63692e6f72672f543363686e30637261742f6c61726176656c2d6c6461702d636f6e6e6563746f722e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/92d0f5bd0c3d319719c4061231bf5d9c5df280ef42d2069a2d3684385830c04a/68747470733a2f2f7472617669732d63692e6f72672f543363686e30637261742f6c61726176656c2d6c6461702d636f6e6e6563746f722e7376673f6272616e63683d6d6173746572)

Package
=======

[](#package)

This package is a fork of dsdevbe's package ().

This package will allow you to authenticate to and fetch data from LDAP using Laravel 5.0.x.

It uses [adLDAP library](https://github.com/adldap/adLDAP) to create a bridge between Laravel and LDAP. adLDAP requires PHP 5 and both the [LDAP](http://php.net/ldap) and [SSL](http://php.net/openssl) libraries

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

[](#installation)

1. Install this package through Composer for Laravel v5.0:

    ```
    composer require T3chn0crat/laravel-ldap-connector:dev-master
    ```
2. 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',
    ```
3. The `config/auth.php` must also have a valid model set. That model must include

    ```
    public function getAuthIdentifier()
    {
        if (isset($this->ldap)) {
            return $this->ldap->samaccountname;
        }
    }
    ```
4. Create a new configuration file `ldap.php` in the configuration folder of Laravel `app/config/ldap.php` and modify to your needs. For more detail of the configuration you can always check on [adLDAP documentation](http://adldap.sourceforge.net/wiki/doku.php?id=documentation_configuration)

**All of these are required**

```
return [
	'account_suffix'=>  "@domain.local",
    // Load balancing domain controllers, but only one is requried
	'domain_controllers'=>  [
        "192.168.0.1",
        "dc02.domain.local"
    ],
	'base_dn'   =>  'DC=domain,DC=local',
    // AD attributes to get http://msdn.microsoft.com/en-us/library/windows/desktop/ms675090%28v=vs.85%29.aspx
    'fields' => [
        'company',
        'department',
        'displayname',
        'homephone',
        'mail',
        'memberof',
        'mobile',
        'primarygroupid',
        'samaccountname',
        'telephonenumber',
        'title',
    ]
];
```

5. Once this is done you arrived at the final step and you will need to add a service provider. Open `config/app.php`, and add a new item to the providers array.

    ```
    'T3chn0crat\LdapConnector\LdapConnectorServiceProvider'
    ```

Usage
-----

[](#usage)

### Authentication

[](#authentication)

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' => $email, '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.

### Getting LDAP fields

[](#getting-ldap-fields)

All the LDAP fields are stored in the `Auth::user()->ldap` object as public properties.

```
Email: {{ Auth::user()->ldap->mail }}
Department {{ Auth::user()->ldap->department }}
```

### LdapUserObject Methods

[](#ldapuserobject-methods)

1. isMemberOf($group)

Will test a user to see if they are a member of the passed in group. Returns a bool

```
if (Auth::user()->ldap->isMemberOf('Git Hub Users')) { return 'yes'; }
```

### Getting all users

[](#getting-all-users)

You can use the LdapService object and getAllUsersWithFields to return a Laravel Collection of LdapUserObjects.

```
$ldap = App::make('T3chn0crat\LdapConnector\LdapService', [Config::get('ldap')]);
$collection = $ldap->getAllUsersWithFields();
```

You can now apply all the collection function to it. The results will be a collection of LdapUserObjects

```
$test = $collection->where('mail', 'test@foo.com');
$department = $test->department;
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

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

Total

2

Last Release

4006d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/433914df4cd887e5788add8bccfea9ef3ba253ebd96f29f9af33ebed616c1c5e?d=identicon)[T3chn0crat](/maintainers/T3chn0crat)

---

Top Contributors

[![BryanHeath](https://avatars.githubusercontent.com/u/239867?v=4)](https://github.com/BryanHeath "BryanHeath (1 commits)")

---

Tags

laravelldap

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/t3chn0crat-laravel-ldap-connector/health.svg)](https://phpackages.com/packages/t3chn0crat-laravel-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)
