Skip to content

Instantly share code, notes, and snippets.

@alanpich
Created November 25, 2013 15:38
Show Gist options
  • Save alanpich/7643199 to your computer and use it in GitHub Desktop.
Save alanpich/7643199 to your computer and use it in GitHub Desktop.
<?php
/**
* The above 2 files (and additionals for all included modules) are merged to form a config cache array
*/
return array(
'factories' => array(
'my.foo.service' => 'Different\Library\Service\Factory\FooServiceFactory'
),
// Invokables are exactly that - invoke this class as-is
'invokables' => array(
'my.bar.service' => 'My\Service\BarService'
)
);
// Get a service by key. Instances are singletons, unless explicitly specified in config.
$fooService = $serviceLocator->get('my.foo.service');
<?php
return array(
// Factories are either a class implementing FactoryInterface, or a callable $var
'factories' => array(
'my.foo.service' => 'My\Service\Factory\FooServiceFactory'
),
// Invokables are exactly that - invoke this class as-is
'invokables' => array(
'my.bar.service' => 'My\Service\BarService'
)
);
<?php
return array(
'factories' => array(
'my.foo.service' => 'Different\Library\Service\Factory\FooServiceFactory'
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment