PHPackages                             gtt/ad-poller - 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. [API Development](/categories/api)
4. /
5. gtt/ad-poller

ActiveLibrary[API Development](/categories/api)

gtt/ad-poller
=============

Polls Active Directory through ldap and dispatches payload using event dispatcher

0.2.0(5y ago)6421[1 issues](https://github.com/GlobalTradingTechnologies/ad-poller/issues)1MITPHPPHP &gt;=5.5|^7.0CI failing

Since Sep 28Pushed 5y ago3 watchersCompare

[ Source](https://github.com/GlobalTradingTechnologies/ad-poller)[ Packagist](https://packagist.org/packages/gtt/ad-poller)[ RSS](/packages/gtt-ad-poller/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (6)Versions (4)Used By (1)

Active Directory Change Poller
==============================

[](#active-directory-change-poller)

[![Build Status](https://camo.githubusercontent.com/69aabe505182083516d04e91bc3d200042528a9af8a1211afcc7c1ac54a6e20f/68747470733a2f2f7472617669732d63692e6f72672f476c6f62616c54726164696e67546563686e6f6c6f676965732f61642d706f6c6c65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/GlobalTradingTechnologies/ad-poller)[![Latest Stable Version](https://camo.githubusercontent.com/8ffead003ecb74ab7ded222a1c7c675adb9f2eaf718ca9eea4d705903d102287/68747470733a2f2f706f7365722e707567782e6f72672f6774742f61642d706f6c6c65722f76657273696f6e)](https://packagist.org/packages/gtt/ad-poller)[![Latest Unstable Version](https://camo.githubusercontent.com/0cb031c42d7add725b092f4aa8330f0e1be8c520acac335887e58da08b12906e/68747470733a2f2f706f7365722e707567782e6f72672f6774742f61642d706f6c6c65722f762f756e737461626c65)](//packagist.org/packages/gtt/ad-poller)[![License](https://camo.githubusercontent.com/6c98b2248eb686ee9debb5382275db9f14ccbf3ff46abf6cafe008a248249186/68747470733a2f2f706f7365722e707567782e6f72672f6774742f61642d706f6c6c65722f6c6963656e7365)](https://packagist.org/packages/gtt/ad-poller)

This package is PHP implementation of [algorithm](https://msdn.microsoft.com/en-us/library/ms677627.aspx) of polling for changes in Active Directory servers using [uSNChanged](https://msdn.microsoft.com/en-us/library/ms677627.aspx) attribute with additional features allowing custom adjustments for Active Directory fetching processes and changesets handling.

The main usage purpose is to keep you application in sync with Active Directory structure.

Overview
========

[](#overview)

The core concept is to constantly poll Active Directory server and perform *incremental* fetch to obtain changesets using [uSNChanged](https://msdn.microsoft.com/en-us/library/ms677627.aspx) attribute as an offset. Each poll task run is persisted in database to save the offset and fetch statistics. In case of Active Directory controller swap, server failures or initial run algorithm performs *full* fetch to obtain the fullset. Received data is subject to deliver to the target application to be handled.

The component consists of three main parts: [poller](#poller), [fetcher](#fetcher) and [synchronizer](#synchronizer).

### Poller

[](#poller)

This is a heart of the library and base implementation of original [polling algorithm](https://msdn.microsoft.com/en-us/library/ms677627.aspx). Uses [fetcher](#fetcher) to interact with Active Directory Server in order to fetch changesets and [synchronizer](#synchronizer)to process obtained changesets.

See [Poller](https://github.com/GlobalTradingTechnologies/ad-poller/blob/master/src/Poller.php) implementation for details.

### Fetcher

[](#fetcher)

This part is responsible to interact with Active Directory. Allows poller to fetch neccessary metadata from Active Directory and search changesets using [zendframework/zend-ldap](https://github.com/zendframework/zend-ldap).

See [LdapFetcher](https://github.com/GlobalTradingTechnologies/ad-poller/blob/master/src/Fetch/LdapFetcher.php) implementation for details.

### Synchronizer

[](#synchronizer)

Synchronizer is about handling datasets received during polling process. Base implementation uses [symfony/event-dispatcher](https://github.com/symfony/event-dispatcher) to publish changesets/fullset as an Events. For incremental sync there is a [IncrementalSyncEvent](https://github.com/GlobalTradingTechnologies/ad-poller/blob/master/src/Sync/Events/Event/IncrementalSyncEvent.php), for full sync - [FullSyncEvent](https://github.com/GlobalTradingTechnologies/ad-poller/blob/master/src/Sync/Events/Event/FullSyncEvent.php).

See [EventSynchronizer](https://github.com/GlobalTradingTechnologies/ad-poller/blob/master/src/Sync/Events/EventSynchronizer.php) implementation for details.

Component provides [SynchronizerInterface](https://github.com/GlobalTradingTechnologies/ad-poller/blob/master/src/Sync/SynchronizerInterface.php) which allows implementation of your own synchronizer for custom aims.

Setup and usage
===============

[](#setup-and-usage)

### Package installation

[](#package-installation)

To install the package use composer:

```
composer require gtt/ad-poller

```

### Database setup

[](#database-setup)

It is possible to generate schema using doctrine console utils. You can clone the repository from scratch, adjust cli-config.php with credentials to your test database and generate init sql:

```
composer install && php ./vendor/bin/doctrine orm:schema-tool:create --dump-sql

```

### Application setup

[](#application-setup)

Create poller:

```
// configure ldap connector
$ldapConnector = new Ldap(
    // Connector options. @see https://github.com/zendframework/zend-ldap for details
    [
        'host' => 'ldap.myorg.com',
        'username' => 'poller@ldap.myorg.com',
        'password' => 'secret',
        'accountDomainName' => 'ldap.myorg.com',
        'baseDn' => 'DC=myorg,DC=com'
    ]
);

// configure ldap fetcher
$ldapFetcher = new \Gtt\ADPoller\Fetch\LdapFetcher(
    $ldapConnector,
    // Optional ldap filter describes entries to fetch during full sync
    '&(objectClass=user)(objectCategory=person))',
    // Optional ldap filter describes entries to fetch during incremental sync.
    // It can differ from the previous one if you want track deactivatation of entities
    // (during full sync you need only active, but here - not)
    '&(objectClass=user)(objectCategory=person))',
    // Optional ldap filter describes deleted entries to fetch during incremental sync
    '&(objectClass=user)(objectCategory=person))',
    // list of properties to be fetched
    ['cn', 'displayname','telephonenumber', 'description']
);
// you also can specify additional ldap search options here if you need, for example:
$ldapFetcher->setLdapSearchOptions(LDAP_OPT_SERVER_CONTROLS, [['oid' => '1.2.840.113556.1.4.529']]);

// configure entity manager to persist poll tasks
$em = \Doctrine\ORM\EntityManager::create($conn, $config);

// configure synchronizer (use your own SynchronizerInterface implementation if needed)
$sync = new \Gtt\ADPoller\Sync\Events\EventSynchronizer(new \Symfony\Component\EventDispatcher\EventDispatcher());

// configure Poller itself
$poller = new Poller(
    $ldapFetcher,
    $sync,
    $em,
    // optionaly you can tell poller to fetch deleted entries
    // @see https://msdn.microsoft.com/en-us/library/ms677927(v=vs.85).aspx for details
    false
    // optional poller name - use it if you have different pollers
    'mypoller'
);
```

You also can create as many pollers as you want with different settings depending on your needs.

Now you can poll Active Directory permanently (normally using crontab) runing something like this:

```
$poller->poll();
```

There is also console command that represents convenient way to run pollers with pretty output and additional options if you use use [symfony/console](https://github.com/symfony/console):

```
// bin/console (do not forget #!/usr/bin/env php at very first line)
// create poller collection
$pollerCollection = new \Gtt\ADPoller\PollerCollection();
// Add poller to collection:
$pollerCollection->addPoller($poller);
// create application and command
$application = new \Symfony\Component\Console\Application();
$application->add(new \Gtt\ADPoller\Command\PollCommand($pollerCollection));
$application->run();
```

And put into crontab command to run all pollers:

```
php bin/console gtt:pollers:run

```

or concrete one:

```
php bin/console gtt:pollers:run --poller=mypoller

```

Framework integration
=====================

[](#framework-integration)

There is a [gtt/ad-poller-bundle](https://github.com/GlobalTradingTechnologies/ad-poller-bundle) which integrates component in Symfony2+ ecosystem

Testing
=======

[](#testing)

To run library test suite just clone the repository and execute the following inside:

```
composer install && ./vendor/bin/phpunit

```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

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.

###  Release Activity

Cadence

Every ~515 days

Total

3

Last Release

2167d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.5

0.2.0PHP &gt;=5.5|^7.0

### Community

Maintainers

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

---

Top Contributors

[![fduch](https://avatars.githubusercontent.com/u/1204137?v=4)](https://github.com/fduch "fduch (24 commits)")

---

Tags

active-directoryldappollersynchronization

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gtt-ad-poller/health.svg)

```
[![Health](https://phpackages.com/badges/gtt-ad-poller/health.svg)](https://phpackages.com/packages/gtt-ad-poller)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M712](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M378](/packages/easycorp-easyadmin-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9317.2k55](/packages/open-dxp-opendxp)

PHPackages © 2026

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