lilweb/ldap-bundle

0.1.1 2013-09-05 08:45 UTC

This package is not auto-updated.

Last update: 2024-09-23 14:59:37 UTC


README

此包有助于连接到现有的LDAP服务器。

安装

将依赖项添加到您的 composer.json 文件

"lilweb/ldap-bundle" : "0.1.0"

将包添加到 AppKernel.php

new Lilweb\LdapBundle\LilwebLdapBundle(),

配置

将以下内容添加到您的 config.yml 文件

lilweb_ldap:
    host: %ldap_client_host%
    port: %ldap_client_port%
    username: %ldap_client_username%
    password: %ldap_client_password%
    version: %ldap_client_version%

使用

现在容器中有一个名为 lilweb.ldap_connection 的新服务。

示例

$entries = $this
    ->ldapConnection
    ->search(
        array(
            'base_dn' => $this->params['base_dn'],
            'filter'  => sprintf('(&%s(%s=%s))', $filter, $this->params['name_attribute'], $this->ldapConnection->escape($username))
        )
    );

技术信息

  • 连接仅在调用连接上的某个方法时建立。
  • 此包需要 PHP-ldap 扩展。