PHP code example of dreamscapes / ldap-core

1. Go to this page and download the library: Download dreamscapes/ldap-core 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/ */

    

dreamscapes / ldap-core example snippets


// Load Composer's autoload script...
espace
use Dreamscapes\Ldap\Core\Ldap;

// If ldap URI is provided, the Ldap instance will also open the connection
// via ldap_connect()
$con = new Ldap('ldap://example.com');
$con->bind('[email protected]', 'my pass'); // Example AD credentials

// Read the rootDSE entry
$res = $con->read('', 'objectclass=*', ['*']);

// $res is now instance of Result class
echo "Number of entries in resultset: " . $res->countEntries();
print_r($res->getEntries());