PHP code example of lawiet / yii2-ldap

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

    

lawiet / yii2-ldap example snippets


php composer.phar 
 ....
    'params' => [
        'ldap' => [
            'hostname' => '127.0.0.1',
            'port' => 389,
            //'security' => 'SSL',
            'bind_dn' => false,
            'bind_password' => false,
            'username' => 'admin',
            'password' => 'admin',
            'base_dn' => 'dc=example,dc=org',
            'filter'  => '(&(objectClass=*))',
            'user_options' => [
                'base_dn' => 'cn=user,dc=example,dc=org',
                'filter' => '(&(objectClass=inetOrgPerson))',
            ],
            'group_options' => [
                'base_dn' => 'cn=group,dc=example,dc=org',
                'filter' => '(&(objectClass=*))',
            ],
            'options' => [
                LDAP_OPT_NETWORK_TIMEOUT => 30,
                LDAP_OPT_PROTOCOL_VERSION => 3,
                LDAP_OPT_REFERRALS => 0,
            ],
        ]
    ]
    ...