mirror of
https://github.com/torrentpier/torrentpier.git
synced 2024-11-08 06:30:43 -08:00
7
Service Provider Minimal Example
Vasily Komrakov edited this page 2017-01-13 16:18:02 +03:00
$container property name MUST be equals to the first word of class name in lower case: ExampleServiceProvider -> example.
namespace TorrentPier\ServiceProviders;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use ExampleNamespace\Example;
/**
* Class ExampleServiceProvider
* @package TorrentPier\ServiceProviders
*/
class ExampleServiceProvider implements ServiceProviderInterface
{
/**
* @inheritdoc
*/
public function register(Container $container)
{
$container['example'] = function (Container $container) {
return new Example();
};
}
}