blanchonvincent/symfony-bridge-module

A bridge to integrate Symfony component

This package's canonical repository appears to be gone and the package has been frozen as a result.

0.3.8 2015-07-29 12:52 UTC

This package is not auto-updated.

Last update: 2019-04-29 01:38:18 UTC


README

Master: Build Status

Introduction

This repository will provide bridge to integrate Symfony component.

Console

To integrate the Symfony2 console component, that's pretty easy :

  • Add configuration to your application.config.php :
return array(
    'modules' => array(
        // your usual config there
    ),
    'module_listener_options' => array(
        // your usual config there
    ),
    'service_manager' => array(
        'invokables' => array(
            'SymfonyBridgeModule\Console\CommandsManager' => 'SymfonyBridgeModule\Console\CommandsManager',
        ),
    ),
    'service_listener_options' => array(
        array(
            'service_manager' => 'SymfonyBridgeModule\Console\CommandsManager',
            'config_key' => 'symfony_commands',
            'interface' => 'SymfonyBridgeModule\ModuleManager\Feature\ConsoleCommandsProviderInterface',
            'method' => 'getConsoleCommands',
        ),
    ),
);

Now, just implements the SymfonyBridgeModule\ModuleManager\Feature\ConsoleCommandsProviderInterface interface in the modules to provide commands :

class Module implements ConsoleCommandsProviderInterface
{
    public function getConsoleCommands()
    {
        return array(
            'invokables' => array(
                'foo' => 'SymfonyBridgeModuleTest\Fixtures\FooModule\Command\FooCommand',
            ),
        );
    }
}

Then copy the console console.php.dist and update the file from your project settings. You can try to run the console.php as an example :

php console.php
Available commands:
 foo    
 help   Displays help for a command
 list   Lists commands

The foo command will print Hello world!.

Container Builder

This module provide a gateway to integrate the container builder from Symfony2.

Router

Once you're using the container builder, the route listener will be automatically added. You have just to provide your routing.yml file inside the config folder.