PHPackages                             puli/discovery - 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. puli/discovery

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

puli/discovery
==============

Publishes and discovers artifacts across Puli packages.

1.0.0-beta9(10y ago)1173.8k1120MITPHPPHP ^5.3.9|^7.0CI failing

Since Jan 12Pushed 9y ago3 watchersCompare

[ Source](https://github.com/puli/discovery)[ Packagist](https://packagist.org/packages/puli/discovery)[ Docs](http://puli.io)[ RSS](/packages/puli-discovery/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (8)Versions (10)Used By (20)

The Puli Discovery Component
============================

[](#the-puli-discovery-component)

[![Build Status](https://camo.githubusercontent.com/7c409256b55fdf38ca06c5d75eccdadab18ddb87c54b4db027789db22201e793/68747470733a2f2f7472617669732d63692e6f72672f70756c692f646973636f766572792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/puli/discovery)[![Build status](https://camo.githubusercontent.com/9e6619fa11c2ecd99de6eb49181b20cdccb1cee1e87480cf5bd4cd69176c1694/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f776d6731346279646b733478777173322f6272616e63682f6d61737465723f7376673d74727565)](https://ci.appveyor.com/project/webmozart/discovery/branch/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7e2af54b7a406a2f76bdbaa06de2ead308645ed0bb8650c8e7448592c48481d3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70756c692f646973636f766572792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/puli/discovery/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/f011d7c73e85a7f4acc96cafa1d3ffa893f669cd6260ad4804943ac379a44702/68747470733a2f2f706f7365722e707567782e6f72672f70756c692f646973636f766572792f762f737461626c652e737667)](https://packagist.org/packages/puli/discovery)[![Total Downloads](https://camo.githubusercontent.com/8dcb3481b04bac5e1c949f5d5bb19c9e3f8363cbcb7002822c234283e88b36cb/68747470733a2f2f706f7365722e707567782e6f72672f70756c692f646973636f766572792f646f776e6c6f6164732e737667)](https://packagist.org/packages/puli/discovery)[![Dependency Status](https://camo.githubusercontent.com/76326b066216e6f80e6326229673de15caa0d8242500971fc0d19ab7beb39ecb/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f70756c693a646973636f766572792f312e302e302f62616467652e737667)](https://www.versioneye.com/php/puli:discovery/1.0.0)

Latest release: [1.0.0-beta9](https://packagist.org/packages/puli/discovery#1.0.0-beta9)

PHP &gt;= 5.3.9

The [Puli](http://puli.io) Discovery Component supports binding of Puli resources to *binding types*. Binding types can be defined with the `addBindingType()` method of the [`EditableDiscovery`](http://api.puli.io/latest/class-Puli.Discovery.Api.EditableDiscovery.html) interface:

```
use Puli\Discovery\Api\Type\BindingType;
use Puli\Discovery\Binding\Initializer\ResourceBindingInitializer;
use Puli\Discovery\InMemoryDiscovery;

$discovery = new InMemoryDiscovery(array(
    // $repo is a Puli\Repository\Api\ResourceRepository instance
    new ResourceBindingInitializer($repo),
));

$discovery->addBindingType(new BindingType('doctrine/xml-mapping'));
```

Resource Bindings
-----------------

[](#resource-bindings)

Resources in the repository can then be bound to the defined type by passing a `ResourceBinding` to `addBinding()`:

```
use Puli\Discovery\Binding\ResourceBinding;

$discovery->addBinding(new ResourceBinding('/app/config/doctrine/*.xml', 'doctrine/xml-mapping'));
```

With `findBindings()`, you can later retrieve all the bindings for the type:

```
foreach ($discovery->findBindings('doctrine/xml-mapping') as $binding) {
    foreach ($binding->getResources() as $resource) {
        // do something...
    }
}
```

The following [`Discovery`](http://api.puli.io/latest/class-Puli.Discovery.Api.Discovery.html) implementations are currently supported:

- [`InMemoryDiscovery`](http://api.puli.io/latest/class-Puli.Discovery.InMemoryDiscovery.html)
- [`KeyValueStoreDiscovery`](http://api.puli.io/latest/class-Puli.Discovery.KeyValueStoreDiscovery.html)
- [`NullDiscovery`](http://api.puli.io/latest/class-Puli.Discovery.NullDiscovery.html)

Read the [Resource Discovery](http://docs.puli.io/en/latest/discovery/introduction.html) guide in the Puli documentation to learn more about resource discovery.

Class Bindings
--------------

[](#class-bindings)

You can also bind classes to binding types. By convention, the common interface of all bound classes is used as binding type:

```
$discovery->addBindingType(new BindingType(Plugin::class));
```

Classes can be bound by adding `ClassBinding` instances:

```
use Puli\Discovery\Binding\ClassBinding;

$discovery->addBinding(new ClassBinding(MyPlugin::class, Plugin::class));
```

As before, use `findBindings()` to find all bindings for a binding type:

```
foreach ($discovery->findBindings(Plugin::class) as $binding) {
    $pluginClass = $binding->getClassName();
    $plugin = new $pluginClass();

    // do something...
}
```

Authors
-------

[](#authors)

- [Bernhard Schussek](http://webmozarts.com) a.k.a. [@webmozart](https://twitter.com/webmozart)
- [The Community Contributors](https://github.com/puli/discovery/graphs/contributors)

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

[](#installation)

Follow the [Installation guide](http://docs.puli.io/en/latest/installation.html) guide to install Puli in your project.

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

[](#documentation)

Read the [Puli Documentation](http://docs.puli.io/en/latest/index.html) to learn more about Puli.

Contribute
----------

[](#contribute)

Contributions to Puli are always welcome!

- Report any bugs or issues you find on the [issue tracker](https://github.com/puli/issues/issues).
- You can grab the source code at Puli’s [Git repository](https://github.com/puli/discovery).

Support
-------

[](#support)

If you are having problems, send a mail to  or shout out to [@webmozart](https://twitter.com/webmozart) on Twitter.

License
-------

[](#license)

All contents of this package are licensed under the [MIT license](LICENSE).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community30

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.9% 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 ~45 days

Recently: every ~57 days

Total

9

Last Release

3778d ago

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

1.0.0-beta9PHP ^5.3.9|^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/00803e109877ea9de0995e81c928871a595781bd6ea227092bfd7c6df5af58f0?d=identicon)[webmozart](/maintainers/webmozart)

---

Top Contributors

[![webmozart](https://avatars.githubusercontent.com/u/176399?v=4)](https://github.com/webmozart "webmozart (160 commits)")[![EmanueleMinotto](https://avatars.githubusercontent.com/u/417201?v=4)](https://github.com/EmanueleMinotto "EmanueleMinotto (7 commits)")[![tgalopin](https://avatars.githubusercontent.com/u/1651494?v=4)](https://github.com/tgalopin "tgalopin (5 commits)")[![SenseException](https://avatars.githubusercontent.com/u/859964?v=4)](https://github.com/SenseException "SenseException (2 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (2 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")[![harikt](https://avatars.githubusercontent.com/u/120454?v=4)](https://github.com/harikt "harikt (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/puli-discovery/health.svg)

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

###  Alternatives

[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k74.6k86](/packages/pocketmine-pocketmine-mp)[getdkan/dkan

DKAN Open Data Catalog

385135.4k2](/packages/getdkan-dkan)[puli/manager

Manages the puli.json file of a Puli project.

6847.9k3](/packages/puli-manager)[sylius/promotion

Flexible promotion management for PHP applications.

28477.8k9](/packages/sylius-promotion)[ymsoft/filament-money

Filament plugin for convenient storage and management of monetary fields

103.4k](/packages/ymsoft-filament-money)

PHPackages © 2026

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