2017 © Pedro Peláez
 

library yaco-service-provider

This package is a bridge between container-intop's service providers and YACO (the PSR-11 compliant container compiler).

image

thecodingmachine/yaco-service-provider

This package is a bridge between container-intop's service providers and YACO (the PSR-11 compliant container compiler).

  • Monday, April 11, 2016
  • by mouf
  • Repository
  • 5 Watchers
  • 0 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Scrutinizer Code Quality Build Status Coverage Status, (*1)

Bridge between container-interop's service providers and YACO

This package is a bridge between container-interop's service providers and YACO, the PSR-11 compliant container compiler., (*2)

Using this package, you can use Yaco to generate PSR-11 compliant containers that contain the services provided by container-interop's service providers., (*3)

Installation

composer require thecodingmachine/yaco-service-provider

Loading a service provider into Yaco

use TheCodingMachine\Yaco\Compiler;
use TheCodingMachine\Yaco\ServiceProvider\ServiceProviderLoader;

// Create your YACO compiler.
$compiler = new Compiler();

// Create your service provider loader
$serviceProviderLoader = new ServiceProviderLoader($compiler);

// Load service providers into Yaco:
$serviceProviderLoader->load(MyServiceProvider::class);
$serviceProviderLoader->load(MyOtherServiceProvider::class);

// Services are now available in Yaco, we just need to dump the container:
$code = $compiler->compile('MyContainer');
file_put_contents(__DIR__.'/MyContainer.php', $code);

Autodiscovering service providers using Puli

If the service providers you are loading are publishing themselves on Puli, you can easily use Puli's discovery mechanism to load the services:, (*4)

// The discoverAndLoad function takes a Puli discovery instance in parameter.
// It will discover and load service providers automatically.
$serviceProviderLoader->discoverAndLoad($discovery)

The Versions

11/04 2016

1.0.x-dev

1.0.9999999.9999999-dev

This package is a bridge between container-intop's service providers and YACO (the PSR-11 compliant container compiler).

  Sources   Download

MIT

The Requires

 

The Development Requires