LDAP Authentication & Management for Laravel.


Built for Laravel Build Status Scrutinizer Code Quality Total Downloads Latest Stable Version License

Adldap2 - Laravel allows easy configuration, access, management and authentication to LDAP connections utilizing the root Adldap2 Repository.


To use Adldap2-Laravel, your application and server must meet the following requirements:

  • Laravel 5.*
  • PHP 5.6 or greater
  • PHP LDAP Extension
  • An Active Directory Server

Note: OpenLDAP support is experimental, success may vary.



Run the following command:

composer require adldap2/adldap2-laravel

Once finished, insert the service provider in your config/app.php file:


Then insert the facade:

'Adldap' => Adldap\Laravel\Facades\Adldap::class

Publish the configuration file by running:

php artisan vendor:publish --tag="adldap"

Now you're all set!


First, configure your LDAP connection in the config/adldap.php file.

Then, you can perform all methods on your Adldap connection through its facade like so:

use Adldap\Laravel\Facades\Adldap;

// Finding a user.
$user = Adldap::search()->users()->find('john doe');

// Searching for a user.
$search = Adldap::search()->where('cn', '=', 'John Doe')->get();

// Running an operation under a different connection:
$users = Adldap::getProvider('other-connection')->search()->users()->get();

// Creating a user.
$user = Adldap::make()->user([
    'cn' => 'John Doe',


Or you can inject the Adldap interface into your controllers:

use Adldap\AdldapInterface;

class UserController extends Controller
     * @var Adldap
    protected $adldap;
     * Constructor.
     * @param AdldapInterface $adldap
    public function __construct(AdldapInterface $adldap)
        $this->adldap = $adldap;
     * Displays the all LDAP users.
     * @return \Illuminate\View\View
    public function index()
        $users = $this->adldap->search()->users()->get();
        return view('users.index', compact('users'));

To see more usage in detail, please visit the Adldap2 Repository.