{"id":16529172,"url":"https://github.com/robertrossmann/ldap","last_synced_at":"2025-10-28T10:32:07.045Z","repository":{"id":10357916,"uuid":"12497086","full_name":"robertrossmann/Ldap","owner":"robertrossmann","description":"DEPRECATED - use https://github.com/Dreamscapes/Ldap-Core instead","archived":true,"fork":false,"pushed_at":"2014-08-31T13:04:59.000Z","size":326,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T04:43:55.757Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robertrossmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-30T22:56:09.000Z","updated_at":"2024-01-03T20:05:42.000Z","dependencies_parsed_at":"2022-09-22T18:51:56.713Z","dependency_job_id":null,"html_url":"https://github.com/robertrossmann/Ldap","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertrossmann%2FLdap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertrossmann%2FLdap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertrossmann%2FLdap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertrossmann%2FLdap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertrossmann","download_url":"https://codeload.github.com/robertrossmann/Ldap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238637966,"owners_count":19505509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T17:44:01.683Z","updated_at":"2025-10-28T10:32:06.731Z","avatar_url":"https://github.com/robertrossmann.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ldap :: Object encapsulation of php's ldap functions\n\n\u003e This library provides a class encapsulation of php's ldap functions. This might be very useful for mocking during unit testing or if you simply prefer the beauty of OOP.\n\n## DEPRECATION NOTICE\n\nThis library is no longer maintained and its usage is discouraged. As a replacement, please take a look at [Dreamscapes/Ldap-Core](https://github.com/Dreamscapes/Ldap-Core) which offers similar functionality.\n\n## Features\n\n - Class Ldap\\Ldap provides function encapsulation of all important php ldap_* functions\n - Class Ldap\\Option provides you with a known ldap options as class constants\n - Class Ldap\\Response provides a nice way to handle server responses\n - Class Ldap\\ResponseCode defines most of the known server response codes for you to use in your implementations\n\n## Installation\n\n### Requirements\n\n - PHP 5.4.0 and newer with LDAP support ( [setup instructions](http://www.php.net/manual/en/ldap.installation.php) )\n - OpenSSL module for SSL / TLS connections ( [setup instructions](http://www.php.net/manual/en/openssl.installation.php) )\n\n#### Via Composer\n\n `composer require alaneor/ldap:dev-master`\u003cbr\u003e\n( visit [Packagist](https://packagist.org/packages/alaneor/ldap) for list of all available versions )\n\n## Documentation\n\nYou use the `Ldap\\Ldap` class to connect to an ldap server. Simply construct the instance with the proper server hostname/IP address and optional port ( default is 389 ) and then use any of the below described functions to work with the connection.\n\n### Example code\n```php\n// Include Composer's autoloader\ninclude 'vendor/autoload.php';\n\n// Open the ldap connection\n$link = new Ldap\\Ldap( 'example.com', 389 );\n\n// Authenticate the connection with the Admin account\n$link-\u003ebind( 'CN=Admin,DC=example,DC=com', 'MySecretPwd!' );\n\n// List the items that are in the baseDN\n$response = $link-\u003eldap_list( 'DC=example,DC=com', 'objectclass=*', ['name', 'objectclass'] );\n\n// Take a look at the structure of the Ldap\\Response instance\nprint_r( $response );\n```\n\n### Method naming\n\nThere are a few rules that generally apply to the method names and their parameters.\n\n1. A method's name is the function's name, stripped of the leading *ldap_* prefix. Where a syntax error would occur ( e.g. *ldap_list* -\u003e *list* or *ldap_8859_to_t61* -\u003e *8859_to_t61* ) the prefix is kept.\n1. The `resource $link_identifier` parameter is omitted in all situations ( the link identifier is stored in the instance of `Ldap\\Ldap` class ).\n1. Where a `resource $result_identifier` is expected, you pass an instance of `Ldap\\Response` class ( e.g. in the `Ldap\\Ldap::sort()` method ) that is returned for all ldap method calls.\n1. For all other function parameters and its default values, standard php documentation applies.\n\n**There are two exceptions to the above naming rules:**\n\nThe pagination control request is even shorter, for your convenience:\u003cbr\u003e\n`ldap_control_paged_result` -\u003e `Ldap\\Ldap::paged_result()`\n\nSince `list` cannot be used as method name, all lookup functions are defined with their prefixes to keep them consistent:\u003cbr\u003e\n`ldap_search` -\u003e `Ldap\\Ldap::ldap_search()`\u003cbr\u003e\n`ldap_list` -\u003e `Ldap\\Ldap::ldap_list()`\u003cbr\u003e\n`ldap_read` -\u003e `Ldap\\Ldap::ldap_read()`\u003cbr\u003e\n\n#### Defined methods:\n\nHere's a list of methods you can use.\n\n##### Class methods\n\nClass methods do not return an instance of Ldap\\Response but directly the output of the mapped function.\n\n - `Ldap\\Ldap::dn2ufn()`\n - `Ldap\\Ldap::err2str()`\n - `Ldap\\Ldap::explode_dn()`\n - `Ldap\\Ldap::ldap_8859_to_t61()`\n - `Ldap\\Ldap::t61_to_8859()`\n\n##### Instance methods\n\n - `Ldap\\Ldap::resource()` -\u003e get the ldap resource identifier\n - `Ldap\\Ldap::rootDSE()` -\u003e read the rootDSE entry of the ldap server\n - `Ldap\\Ldap::add()`\n - `Ldap\\Ldap::bind()`\n - `Ldap\\Ldap::compare()`\n - `Ldap\\Ldap::delete()`\n - `Ldap\\Ldap::get_option()`\n - `Ldap\\Ldap::ldap_list()`\n - `Ldap\\Ldap::ldap_read()`\n - `Ldap\\Ldap::ldap_search()`\n - `Ldap\\Ldap::mod_add()`\n - `Ldap\\Ldap::mod_del()`\n - `Ldap\\Ldap::mod_replace()`\n - `Ldap\\Ldap::modify()`\n - `Ldap\\Ldap::paged_result()`\n - `Ldap\\Ldap::rename()`\n - `Ldap\\Ldap::sasl_bind()`\n - `Ldap\\Ldap::set_option()`\n - `Ldap\\Ldap::set_rebind_proc()`\n - `Ldap\\Ldap::sort()`\n - `Ldap\\Ldap::start_tls()`\n - `Ldap\\Ldap::unbind()`\n\n### Response structure\n\nEach method call returns **new instance** of the `Ldap\\Response` class.\n\nThe structure of the response is as follows:\n\n - `Ldap\\Response::result` - Whatever the ldap function returned, either a boolean, a resource or anything else\n - `Ldap\\Response::data` - If a function returned a resource, the actual ldap data will be already extracted here\n - `Ldap\\Response::code` - The ldap response code of the operation performed\n - `Ldap\\Response::message` - The ldap response message that corresponds to the response code\n - `Ldap\\Response::referrals` - If the server responds with referrals, you will find them here\n - `Ldap\\Response::cookie` - For paged result responses, a cookie will be here, if returned from server\n - `Ldap\\Response::estimated` - The estimated number of objects remaining to return from server when doing paged searches ( not all ldap implementations return this value )\n - `Ldap\\Response::matchedDN` - Not much is known here; read php's documentation about [ldap_parse_result()](http://www.php.net/manual/en/function.ldap-parse-result.php)\n\nNot all properties have values in all situations - some of them are only present when doing specific actions, like the *cookie* - it will only be present when pagination is enabled, a lookup operation has been executed and the server returned a cookie.\n\n## License\n\nThis software is licensed under the **BSD (3-Clause) License**.\nSee the [LICENSE](LICENSE) file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertrossmann%2Fldap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertrossmann%2Fldap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertrossmann%2Fldap/lists"}