PHP code example of anthonyedmonds / laravel-ldap-emulator

1. Go to this page and download the library: Download anthonyedmonds/laravel-ldap-emulator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

anthonyedmonds / laravel-ldap-emulator example snippets


use AnthonyEdmonds\LaravelLdapEmulator\Providers\LdapEmulatorServiceProvider;

return [
    ...
    LdapEmulatorServiceProvider::class,
    ...
];

Fortify::authenticateUsing(function ($request) {
    if (config('ldap-emulator.enabled') === true) {
        LdapEmulatorServiceProvider::setActingUser($request->username);
    }

    $validated = Auth::validate([
        'samaccountname' => $request->username,
        'password' => $request->password,
    ]);

    return $validated ? Auth::getLastAttempted() : null;
});