2017 © Pedro Peláez
 

library discovery

Publishes and discovers artifacts across Puli packages.

image

puli/discovery

Publishes and discovers artifacts across Puli packages.

  • Monday, August 15, 2016
  • by webmozart
  • Repository
  • 5 Watchers
  • 12 Stars
  • 59,045 Installations
  • PHP
  • 40 Dependents
  • 1 Suggesters
  • 12 Forks
  • 0 Open issues
  • 10 Versions
  • 2 % Grown

The README.md

The Puli Discovery Component

Build Status Build status Scrutinizer Code Quality Latest Stable Version Total Downloads Dependency Status, (*1)

Latest release: 1.0.0-beta9, (*2)

PHP >= 5.3.9, (*3)

The Puli Discovery Component supports binding of Puli resources to binding types. Binding types can be defined with the addBindingType() method of the [EditableDiscovery] interface:, (*4)

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

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

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:, (*6)

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

The following [Discovery] implementations are currently supported:, (*7)

  • [InMemoryDiscovery]
  • [KeyValueStoreDiscovery]
  • [NullDiscovery]

Read the Resource Discovery guide in the Puli documentation to learn more about resource discovery., (*8)

Class Bindings

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

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

Classes can be bound by adding ClassBinding instances:, (*10)

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:, (*11)

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

    // do something...
}

Authors

Installation

Follow the Installation guide guide to install Puli in your project., (*12)

Documentation

Read the Puli Documentation to learn more about Puli., (*13)

Contribute

Contributions to Puli are always welcome!, (*14)

Support

If you are having problems, send a mail to bschussek@gmail.com or shout out to @webmozart on Twitter., (*15)

License

All contents of this package are licensed under the MIT license., (*16)

The Versions

15/08 2016

dev-master

9999999-dev http://puli.io

Publishes and discovers artifacts across Puli packages.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bernhard Schussek

14/01 2016

1.0.0-beta9

1.0.0.0-beta9 http://puli.io

Publishes and discovers artifacts across Puli packages.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bernhard Schussek

05/10 2015
24/08 2015

1.0.0-beta7

1.0.0.0-beta7 http://puli.io

Discovers Puli resources bound to predefined types.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bernhard Schussek

12/08 2015

1.0.0-beta6

1.0.0.0-beta6 http://puli.io

Discovers Puli resources bound to predefined types.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bernhard Schussek

29/05 2015

1.0.0-beta5

1.0.0.0-beta5 http://puli.io

Discovers Puli resources bound to predefined types.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bernhard Schussek

13/04 2015

1.0.0-beta4

1.0.0.0-beta4 http://puli.io

Discovers Puli resources bound to predefined types.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bernhard Schussek

19/03 2015

1.0.0-beta3

1.0.0.0-beta3 http://puli.io

Discovers Puli resources bound to predefined types.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bernhard Schussek

27/01 2015

1.0.0-beta2

1.0.0.0-beta2 http://puli.io

Discovers Puli resources bound to predefined types.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bernhard Schussek

12/01 2015

1.0.0-beta

1.0.0.0-beta http://puli.io

Discovers Puli resources bound to predefined types.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bernhard Schussek