src/Adldap2Wrapper.php
public function init()
    {
        if(!isset($this->adLdapInstance)) {
            $this->adLdapInstance = new Adldap();
        }

        foreach($this->providers as $providerName=>$prodivderSettings) {
            $config = new \Adldap\Connections\Provider($prodivderSettings['config']);
            $this->adLdapInstance->addProvider($config, $providerName);

            if (array_key_exists('schema',$prodivderSettings) && is_object($prodivderSettings['schema'])) {
                $this->adLdapInstance->getProvider($providerName)->setSchema($prodivderSettings['schema']);
            }

            if($prodivderSettings['autoconnect'] == true) {
                $this->adLdapInstance->connect($providerName);
            }
        }

        $providers = $this->adLdapInstance->getProviders();

        if (array_key_exists($this->defaultProvider, $providers)) {
            $this->adLdapInstance->setDefaultProvider($this->defaultProvider);
        } else {
            throw new \yii\base\Exception("The given defaultprovder with the name " . $this->defaultProvider . " could not be found. See https://github.com/edvler/yii2-adldap-module/blob/master/readme.md");
        }
    }
public function init()
    {
        if(!isset($this->adLdapInstance)) {
            $this->adLdapInstance = new Adldap();
        }

        foreach($this->providers as $providerName=>$prodivderSettings) {
            $config = new \Adldap\Connections\Provider($prodivderSettings['config']);
            $this->adLdapInstance->addProvider($config, $providerName);

            if (array_key_exists('schema',$prodivderSettings) && is_object($prodivderSettings['schema'])) {
                $this->adLdapInstance->getProvider($providerName)->setSchema($prodivderSettings['schema']);
            }

            if($prodivderSettings['autoconnect'] == true) {
                $this->adLdapInstance->connect($providerName);
            }
        }

        $providers = $this->adLdapInstance->getProviders();

        if (array_key_exists($this->defaultProvider, $providers)) {
            $this->adLdapInstance->setDefaultProvider($this->defaultProvider);
        } else {
            throw new \yii\base\Exception("The given defaultprovder with the name " . $this->defaultProvider . " could not be found. See https://github.com/edvler/yii2-adldap-module/blob/master/readme.md");
        }
    }
init() called by yii.