2017 © Pedro Peláez
 

library ocra-service-manager

ZF2 Service manager extensions to allow service proxies and dependency graph generation

image

ocramius/ocra-service-manager

ZF2 Service manager extensions to allow service proxies and dependency graph generation

  • Sunday, July 3, 2016
  • by Ocramius
  • Repository
  • 9 Watchers
  • 48 Stars
  • 23,766 Installations
  • PHP
  • 3 Dependents
  • 2 Suggesters
  • 18 Forks
  • 6 Open issues
  • 16 Versions
  • 5 % Grown

The README.md

OcraServiceManager

OcraServiceManager is a Zend Framework 2 Module that decorates Zend\ServiceManager\ServiceManager to allow tracking dependencies between services., (*1)

It integrates with ZendDeveloperTools to provide aid in debugging what is happening between your dependencies, allowing you to produce dependency graphs such as the following one:, (*2)

Example Dependency Graph generated by <code>OcraServiceManager</code>, (*3)

It is heavily tested and supports proxying of any possible object type., (*4)

If you don't know what proxies are, you can read my article about service proxies and why we need them., (*5)

Status

Tests Releases Downloads Dependencies
Build Status Scrutinizer Quality Score Code Coverage Latest Stable Version Latest Unstable Version Total Downloads Dependency Status

Installation

The recommended way to install ocramius/ocra-service-manager is through composer:, (*6)

php composer.phar require ocramius/ocra-service-manager

You can then enable this module in your config/application.config.php by adding OcraServiceManager to the modules key:, (*7)

// ...
    'modules' => array(
        // add OcraServiceManager and ZDT...
        'ZendDeveloperTools',
        'OcraServiceManager',
        // ... and then your stuff
        'MyOwnModule',
    ),

Please note that you need to enable service manager logging and the ZendDeveloperTools toolbar to actually see something working., (*8)

Configuration

Following config keys are provided by default, but you can change them as you want. You can drop a file ocra-service-manager.local.php into your config/autoload directory to enable or disable logging of your service manager instances:, (*9)

return array(
    'ocra_service_manager' => array(
        // Turn this on to disable dependencies view in Zend Developer Tools
        'logged_service_manager' => true,
    ),
);

Please note that logging is enabled by default, (*10)

Testing and Contributing

Please refer to the contents of .travis.yml to see how to test your patches against OcraServiceManager., (*11)

Any pull requests will be accepted only if:, (*12)

  • code coverage on newly introduced code is >= 90% (use @coversNothing on integration tests, please)
  • coding standard complies with PSR-2
  • generally tries to respect object calisthenics

Known limitations:

  • Installing the module itself won't allow tracking the first service-manager events in your application. If you need to have that working, you will need to override the implementation of Zend\Mvc\Application::init()
  • If you have an authorization module enabled, be aware that OcraServiceManager registers a new controller 'OcraServiceManager\Controller\YumlController' as well as a new route 'ocra_service_manager_yuml'. You will need to enable access to both these in development mode in order to see the dependencies diagram.

The Versions