PHPackages                             szabogyula/ldaporm-bundle - 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. [Database &amp; ORM](/categories/database)
4. /
5. szabogyula/ldaporm-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

szabogyula/ldaporm-bundle
=========================

LDAP ORM for Symfony2

5.0.2(4y ago)02301MITPHPPHP &gt;=5.6.14

Since Jan 7Pushed 4y ago1 watchersCompare

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

READMEChangelog (6)Dependencies (1)Versions (34)Used By (0)

UcsfLdapOrm
===========

[](#ucsfldaporm)

A Symfony bundle that provides ORM over LDAP.

This code was originally based upon [Mathieu Goulin](https://github.com/matgou)'s [GorgLdapOrmBundle](https://github.com/matgou/GorgLdapOrmBundle). We are forever indebted to him for providing an excellent base for the work we've continued at UCSF IT Identity &amp; Access Management. Originally we forked GorgLdapOrmBundle but, as our development continued to diverge and added new functionality, we came to the point where it was time to strike out on our own. The UcsfLdapOrm repo was created as that fresh start.

What's changed and/or been added so far:

- Added the `LdapEntity` class. This is a Symfony entity which represents the `top` LDAP object class.
- Added many subclasses of `LdapEntity` to describe the object classes from `top` down to `InetOrgPerson`.
- Added `Repository::filterByComplex()` which gives the entity manager/repository the ability to filter with custom constructed, complex boolean logic. (See code comment API documentation for details.)
- Removed the dependency upon [r1pp3rj4ck](https://github.com/r1pp3rj4ck)'s [TwigstringBundle](https://github.com/r1pp3rj4ck/TwigstringBundle) and replaced it with Symfony 2.6+'s ability to use Twig's new-ish string-as-template functionality.

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

[](#installation)

Requires PHP5.5+ and Symphony 2.7+

- Add to composer.json
- `"ucsf/ldaporm": "dev-master"`
- Add the bundle to AppKernel.php
- `new Ucsf\LdapOrmBundle\UcsfLdapOrmBundle()`
- Install using composer
- `$ composer update ucsf/ldaporm-bundle`

Documentation
-------------

[](#documentation)

### Develop with UcsfLdapOrm

[](#develop-with-ucsfldaporm)

#### Configure an LDAP service in config.yml

[](#configure-an-ldap-service-in-configyml)

```
parameters:
    some_ldap_server:
        uri: ldaps://ldap.example.com
        use_tls: true
        bind_dn: cn=admin,dc=example,dc=com
        password: shhhItsASecret
        password_type: plaintext
    ucsfldaporm_test: false

```

- **uri**: The URI you need for connecting to the LDAP service.
- **use\_tls**: 'true' or 'false' to decide on connecting with TLS
- **bind\_dn**: The DN for binding to the LDAP service
- **password**: The password associated with the given bind DN
- **password\_type**: `sha1` or `plaintext`. I use plaintext when the URI is LDAPS.

#### Dependency injection for LDAP Entity Managers and Services

[](#dependency-injection-for-ldap-entity-managers-and-services)

```
services:
    myldap_entity_manager:
        class: Ucsf\LdapOrmBundle\Ldap\LdapEntityManager
        public: true
        arguments: ["@logger", "@annotation_reader", "%some_ldap_server%"]
    comexample_person_service:
        class: MyBundle\ComExamplePersonService
        arguments: [ @myldap_entity_manager ]

```

#### Creating Entities (usually to represent an object class)

[](#creating-entities-usually-to-represent-an-object-class)

```
/**
 * Represents a ComExamplePerson object class, which is a subclass of InetOrgPerson
 *
 * @ObjectClass("comExamplePerson")
 * @SearchDn("ou=people,dc=example,dc=come")
 * @Dn("uid={{ entity.uid }},ou=people,dc=example,dc=com")
 */
class ComExamplePerson extends InetOrgPerson
{
    /**
     * @Attribute("comExampleFavoriteIceCreamFlavor")
     * @Must()
     * @ArrayField()
     *
     * The @Attribute annotation relates the $comExampleFavoriteIceCreamFlavor member variable to the
     * 'comExampleFavoriteIceCreamFlavor' attribute within the ComExamplePerson object class in LDAP.
     * You don't have to name the PHP variable the same as your attribute name, but it helps to be
     * consistent in this way.
     *
     * The @Must annotation requires this attribute to not be empty when persisting back to LDAP. If
     * a @Must requirement is not satisfied, attempting to persist the entry will throw
     * a MissingMustAttributeException.
     *
     * The @ArrayField aannotation tells the LDAP Entity Manager, repositories and services to treat
     * this attribute as a multi-value LDAP field. This is unfortunately backwards from LDAP's default
     * to multi-value an attribute. Baring miracles (i.e. finding the time), this will probably not be "fixed".
     *
     */
    protected $comExampleFavoriteIceCreamFlavor;

    ...

    public function getComExampleFavoriteIceCreamFlavor() {
        return $this->comExampleFavoriteIceCreamFlavor;
    }

    public function setComExampleFavoriteIceCreamFlavor($comExampleFavoriteIceCreamFlavor) {
        $this->comExampleFavoriteIceCreamFlavor = $comExampleFavoriteIceCreamFlavor;
    }

    ...
}

```

#### Coding the Service

[](#coding-the-service)

```
    class ComExamplePersonService {

    protected $comExamplePersonRepository;

    public function __construct(LdapEntityManager $entityManager) {
        // Make a repo for ComExamplePerson entities
        $this->comExamplePersonRepository = $entityManager->getRepository(ComExamplePerson::class);
        // Make a another repo for SomethignElse entities (just another example...)
        $this->somethingElseRepository = $entityManager->getRepository(SomethingElse::class);
        ...
    }

    public function getPersonByUid($uid, $includeAddress = false, $attributes = null) {
        $person = $this->comExampePersonRepository->findByUid($uid, $attributes);
        ...
        return $person;
    }

```

#### A Controller... to Round it Out

[](#a-controller-to-round-it-out)

```
    class PeopleController extends Controller {

        /**
         * @Route("/person/detail/{uid}")
         * @Template()
         */
        public function detailAction(Request $request, $uid)
        {
            $comExamplePersonService = $this->get('comexample_person_service');
            $person = $comExamplePersonService->getPersonByUid($uid);
            ...
            return array('person' => $person);
        }

```

To do
-----

[](#to-do)

1. Remove need for generic LDAP config
2. Configuration documentation
3. Development example
4. Rewrite test suite (In progress...)
5. Remove deprecated search results iterator

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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.

###  Release Activity

Cadence

Every ~70 days

Recently: every ~100 days

Total

32

Last Release

1578d ago

Major Versions

1.1.2 → 2.1.02017-03-14

2.2.3 → 3.0.02017-06-24

2.2.5 → 3.0.12017-07-20

3.0.16 → 4.0.12018-04-24

4.0.3 → 5.0.02021-12-16

PHP version history (2 changes)1.0.0PHP &gt;=5.3.9

2.2.2PHP &gt;=5.6.14

### Community

Maintainers

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

---

Top Contributors

[![jasongabler](https://avatars.githubusercontent.com/u/1828132?v=4)](https://github.com/jasongabler "jasongabler (30 commits)")[![szabogyula](https://avatars.githubusercontent.com/u/3406217?v=4)](https://github.com/szabogyula "szabogyula (10 commits)")[![NKPmedia](https://avatars.githubusercontent.com/u/3307081?v=4)](https://github.com/NKPmedia "NKPmedia (3 commits)")[![annamariaF1](https://avatars.githubusercontent.com/u/37869961?v=4)](https://github.com/annamariaF1 "annamariaF1 (2 commits)")

---

Tags

symfonyormldapucsf

### Embed Badge

![Health badge](/badges/szabogyula-ldaporm-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/szabogyula-ldaporm-bundle/health.svg)](https://phpackages.com/packages/szabogyula-ldaporm-bundle)
```

###  Alternatives

[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M154](/packages/sonata-project-doctrine-orm-admin-bundle)[omines/datatables-bundle

Symfony DataTables Bundle with native Doctrine ORM, Elastica and MongoDB support

2851.4M6](/packages/omines-datatables-bundle)

PHPackages © 2026

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