toshy62/openldapobject
最新稳定版本:1.3.6
Composer 安装命令:
composer require toshy62/openldapobject
包简介
Use Object to Read/Write in a LDAP
README 文档
README
Use Object to Read/Write in a LDAP
Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require openldapobject/openldapobject "~1"
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Or add the bundle in your composer.json and launch this command composer update
...
"require" : {
...
"openldapobject/openldapobject": "~1.0",
...
},
...
Step 2: Configuration
Add configuration keys in the app/config/parameters.yml and app/config/parameters.yml.dist and configure for your openldap :
ldap_hostname: ldap-test.univ.fr
ldap_base_dn: 'dc=univ,dc=fr'
ldap_dn: 'cn=login,ou=ldapusers,dc=univ,dc=fr'
ldap_password: 'password'
Step 3: Use the Bundle
You can use this bundle like this :
<?php namespace AppBundle\Controller; use OpenLdapObject\LdapClient\Connection; use OpenLdapObject\LdapClient\Client; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class DefaultController extends Controller { /** * @Route("/example", name="example") */ public function exampleAction() { $ldap = new Connection($this->container->getParameter('ldap_hostname'), 389); $ldap->identify($this->container->getParameter('ldap_dn'), $this->container->getParameter('ldap_password')); $client = $ldap->connect(); $client->setBaseDn($this->container->getParameter('ldap_base_dn')); $query = "(&(objectclass=*)(sn=Hetru))"; $accounts = $client->search($query, array('*', 'memberof'), 0, 'ou=accounts'); dump($accounts); ... } } ... ...
统计信息
- 总下载量: 44
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-07