ppokatilo / services-loader
Easier loading of services.d
Installs: 9 812
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.5.0
- symfony/config: ~2.0|~3.0
- symfony/dependency-injection: ~2.0|~3.0
- symfony/finder: ~2.0|~3.0
This package is not auto-updated.
Last update: 2024-12-17 05:21:06 UTC
README
Easier loading of services in your Symfony2 bundle's extension.
How to use
Use ServiceLoader to load service definitions from files in directories (recursively, if you wish).
<?php namespace You\YourBundle\DependencyInjection; use SHyx0rmZ\ServicesLoader\ServicesLoader; class YourExtension extends Extension { public function load(array $config, ContainerBuilder $container) { $loader = new ServiceLoader($container); $loader->loadFromFile(__DIR__ . '/../Resources/config/services.ini'); $loader->loadFromDirectory(__DIR__ . '/../Resources/config/services.d'); } }
Use the Extension to make loading even easier.
<?php namespace You\YourBundle\DependencyInjection; use SHyx0rmZ\ServicesLoader\Extension\ServicesLoaderExtension; class YourExtension extends ServicesLoaderExtension { }
Which will load service definitions from:
- YourBundle/Resources/config/services.ini
- YourBundle/Resources/config/services.php
- YourBundle/Resources/config/services.xml
- YourBundle/Resources/config/services.yml
- and everything in services.d
- YourBundle/Resources/config/services.d/commands.yml
- YourBundle/Resources/config/services.d/database/clients.yml