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

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

freefcw/ldap-auth
=================

Laravel 5 Active Directory LDAP Authentication driver

v2.0.1(11y ago)1211PHPPHP &gt;=5.3.0

Since Jul 3Pushed 11y ago1 watchersCompare

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

READMEChangelogDependencies (5)Versions (16)Used By (0)

Active Directory LDAP Authentication
====================================

[](#active-directory-ldap-authentication)

Laravel 5 Active Directory LDAP Authentication driver.

Fork
====

[](#fork)

This is a fork of strebl's l5-ldap-auth.

This is a fork of Cody Covey's ldap-auth package. Unfortunately he doesn't develeped the package recently and didn't update the package to Laravel 4.1+ or even Laravel 5. Therefore I decided to fork the package to provide a minimal Laravel 5 support.

The first release, 2.0, isn't well tested. Just be careful!

This is used for my self currently. Any problem please make a new issue or pull request, I will test it as soon as possible.

Contribution
------------

[](#contribution)

Just post an issue or create a pull request on this repository. I'll really appreciate it.

Installation
============

[](#installation)

Laravel 5
---------

[](#laravel-5)

This will follow releases similar to how Laravel itself manages releases. When Laravel moves to 5.1 this package will move to 2.1, with minor versions signifying bug fixes, etc. To install this package add the following to your composer.json

```
require {
	"freefcw/ldap-auth": "~2.0",
}
```

Then run

`composer install` or `composer update` as appropriate

Once you have finished downloading the package from Packagist.org you need to tell your Application to use the LDAP service provider.

Open `config/app.php` and find

`Illuminate\Auth\AuthServiceProvider`

and replace it with

`Ccovey\LdapAuth\LdapAuthServiceProvider`

This tells Laravel 4 to use the service provider from the vendor folder.

You also need to direct Auth to use the ldap driver instead of Eloquent or Database, edit `config/auth.php` and change driver to `ldap`

Laravel 4
---------

[](#laravel-4)

***The Laravel 4 version of this package is no longer developed.***

To install this package add the following to your composer.json

```
require {
	"freefcw/ldap-auth": "~1.0",
}
```

Then run

`composer install` or `composer update` as appropriate

Once you have finished downloading the package from Packagist.org you need to tell your Application to use the LDAP service provider.

Open `config/app.php` and find

`Illuminate\Auth\AuthServiceProvider`

and replace it with

`Ccovey\LdapAuth\LdapAuthServiceProvider`

This tells Laravel 4 to use the service provider from the vendor folder.

You also need to direct Auth to use the ldap driver instead of Eloquent or Database, edit `config/auth.php` and change driver to `ldap`

Configuration
=============

[](#configuration)

To specify the username field to be used in `app/config/auth.php` set a key / value pair `'username_field' => 'fieldname'` This will default to `username` if you don't provide one.

To set up your adLDAP for connections to your domain controller, create a file app/config/adldap.php This will provide all the configuration values for your connection. For all configuration options an array like the one below should be provided.

It is important to note that the only required options are `account_suffix`, `base_dn`, and `domain_controllers`The others provide either security or more information. If you don't want to use the others simply delete them.

```
return array(
	'account_suffix' => "@domain.local",

	'domain_controllers' => array("dc1.domain.local", "dc2.domain.local"), // An array of domains may be provided for load balancing.

	'base_dn' => 'DC=domain,DC=local',

	'admin_username' => 'user',

	'admin_password' => 'password',
	'real_primary_group' => true, // Returns the primary group (an educated guess).

	'use_ssl' => true, // If TLS is true this MUST be false.

	'use_tls' => false, // If SSL is true this MUST be false.

	'recursive_groups' => true,
);
```

Usage
=====

[](#usage)

$guarded is now defaulted to all so to use a model you must change to `$guarded = array()`. If you store Roles or similar sensitive information make sure that you add that to the guarded array.

Use of `Auth` is the same as with the default service provider.

By Default this will have the `username (samaccountname)`, `displayname`, `primary group`, as well as all groups user is a part of

To edit what is returned you can specify in `config/auth.php` under the `fields` key.

For more information on what fields from AD are available to you visit

You may also get a complete user list for a specific OU by defining the `userList` key and setting it to `true`. You must also set the `group` key that defined which OU to look at. Do not that on a large AD this may slow down the application.

Model Usage
===========

[](#model-usage)

You can still use a model with this implementation as well if you want. ldap-auth will take your fields from ldap and attach them to the model allowing you to access things such as roles / permissions from the model if the account is valid in Active Directory. It is also important to note that no authentication takes place off of the model. All authentication is done from Active Directory and if they are removed from AD but still in a users table they WILL NOT be able to log in.

Notice
======

[](#notice)

The traits will override the parent class method!

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 57.3% 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 ~53 days

Recently: every ~107 days

Total

13

Last Release

4059d ago

Major Versions

v1.1.5 → v2.02015-02-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c8325aaf445065ba22388571aa0af16308d452fb18d326229bc65c553a99ffe?d=identicon)[freefcw](/maintainers/freefcw)

---

Top Contributors

[![ccovey](https://avatars.githubusercontent.com/u/1609830?v=4)](https://github.com/ccovey "ccovey (55 commits)")[![domex](https://avatars.githubusercontent.com/u/1824722?v=4)](https://github.com/domex "domex (16 commits)")[![strebl](https://avatars.githubusercontent.com/u/6151204?v=4)](https://github.com/strebl "strebl (11 commits)")[![freefcw](https://avatars.githubusercontent.com/u/417011?v=4)](https://github.com/freefcw "freefcw (7 commits)")[![aaronmaturen](https://avatars.githubusercontent.com/u/507070?v=4)](https://github.com/aaronmaturen "aaronmaturen (3 commits)")[![kreeves](https://avatars.githubusercontent.com/u/391940?v=4)](https://github.com/kreeves "kreeves (1 commits)")[![nickdenardis](https://avatars.githubusercontent.com/u/37359?v=4)](https://github.com/nickdenardis "nickdenardis (1 commits)")[![stevebauman](https://avatars.githubusercontent.com/u/6421846?v=4)](https://github.com/stevebauman "stevebauman (1 commits)")[![Kindari](https://avatars.githubusercontent.com/u/488872?v=4)](https://github.com/Kindari "Kindari (1 commits)")

---

Tags

laravelAuthenticationldaplaravel 5l5

### Embed Badge

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

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

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[laragear/two-factor

On-premises 2FA Authentication for out-of-the-box.

339785.3k8](/packages/laragear-two-factor)[laragear/webauthn

Authenticate users with Passkeys: fingerprints, patterns and biometric data.

403480.4k8](/packages/laragear-webauthn)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2011.0k](/packages/alajusticia-laravel-logins)

PHPackages © 2026

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