PHPackages                             mikebywater/ldap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mikebywater/ldap

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mikebywater/ldap
================

My simple, crude LDAP package

1179PHP

Since Mar 30Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mikebywater/ldap)[ Packagist](https://packagist.org/packages/mikebywater/ldap)[ RSS](/packages/mikebywater-ldap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

My Crude LDAP Class
===================

[](#my-crude-ldap-class)

Installation
------------

[](#installation)

### Composer

[](#composer)

To install simply put the following in your composer json file

```
"require": {
  		"mikebywater/ldap": "dev-master"
},

```

next simply run

```
composer update

```

Parameters
----------

[](#parameters)

ldap relies on global variables being set.

### Laravel

[](#laravel)

In Laravel simply set the variables below in the .env file

```
LDAP_SERVER =server.example.com
LDAP_DOMAIN=mydomain
LDAP_BASE_DSN=dc=example,dc=com
LDAP_ADMIN_USER=admin
LDAP_ADMIN_PASSWORD=password
```

Usage
-----

[](#usage)

### Authenticating a user

[](#authenticating-a-user)

```
use mikebywater\LDAP\LDAP as LDAP;
$ldap = new LDAP();
$username = 'testmember';
$password = 'test123';
if($ldap->authenticate($username,$password))
{
 echo "Authenticated";
}
else
{
    echo "Invalid Credentials";
}
```

### Searching LDAP

[](#searching-ldap)

```
use mikebywater\LDAP\LDAP as LDAP;
// Instantiate object
$ldap = new LDAP();
$username = "george.land";
// Method chaining allows us to bind to ldap, apply an ldap filter and get the first result
$entry = $ldap->bind()->filter("sAMAccountName=$username")->get()->first();
```

### Extracting user Details from an entry

[](#extracting-user-details-from-an-entry)

By using the LDAPUser class we can get user details from an entry

```
use mikebywater\LDAP\LDAPUser as LDAPUser;
// Instantiating the object requires you to pass your ldap connection and the entry
// from the previous example
$user = new LDAPUser($ldap->conn, $entry);
$name =  $user->getName(); //special function for display name
$email = $user->getEmail(); //special function foe mail attributes
$company= $user->__get('company')[0]; // any other attribute can be grabbed with magic get method (beware will return an array)
$description= $user->__get('description')[0];
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f10e79dac4abaf48fd84299d1b10e9dd6ce0d170039b7fed9b5e197c9f63ca1a?d=identicon)[mikebywater](/maintainers/mikebywater)

---

Top Contributors

[![mikebywater](https://avatars.githubusercontent.com/u/3317281?v=4)](https://github.com/mikebywater "mikebywater (10 commits)")

### Embed Badge

![Health badge](/badges/mikebywater-ldap/health.svg)

```
[![Health](https://phpackages.com/badges/mikebywater-ldap/health.svg)](https://phpackages.com/packages/mikebywater-ldap)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
