"Drupal Symfony Inject" allow you to use the Symfony dependency injection component inside your Drupal 7 projects. The module offers you with hooks to have your own Yaml configurations, fully PSR-0 compatible namespaces and settings inside your custom modules. The Symfony container is fully compiled and cached in Drupal.

PHP Version: 5.3.x or greater.
Dependencies: Composer Manager

API Hooks

  1. hook_namespace_register : Register custom namespaces you need in your module. The implementation expects a key value paired array. The key should be the namespace and the value should be the path to the namespace.
  2. hook_symfony_yaml_config : Define custom paths to your Symfony DI Yaml config files. Implementation should return an array with key value pair, The key should be the Yaml file name and the value should be the path to the Yaml file.

    ex: array('config.yaml' => '/config/yaml');

    In the above example, the config file is config.yaml and the path to it is '/config/yaml'.
  3. hook_symfony_yaml_config_params : Any custom parameters you need to set in the Yaml config. Again this should return an array where keys should be the parameters and the values as the values for the parameter.

Drupal Alter

symfony_container_builder_alter : To add any final config changes to Symfony DI container before it gets compiled and saved in Drupal cache.

Raise issues on Github

Development for this module takes place over on Github. Please raise issues over there.

Supporting organizations: 
sponsored development of this module

Project information