Last active
September 2, 2017 16:41
-
-
Save B-Galati/0cc9c388bc3287d4400cd28172f5eb2e to your computer and use it in GitHub Desktop.
Symfony demo with Fluent PHP format for services
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use AppBundle\Command\ListUsersCommand; | |
use AppBundle\EventListener\CommentNotificationSubscriber; | |
use AppBundle\EventListener\RedirectToPreferredLocaleSubscriber; | |
use AppBundle\Twig\AppExtension; | |
use AppBundle\Utils\Slugger; | |
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | |
use Twig\Extensions\IntlExtension; | |
return function (ContainerConfigurator $c) { | |
$s = $c | |
->services() | |
->defaults() | |
->private() | |
->autoconfigure() | |
->autowire(); | |
$s->load('AppBundle\\', '../../src/AppBundle/*') | |
->exclude('../../src/AppBundle/{Controller,Entity,Repository,Tests}'); | |
$s->load('AppBundle\\Controller\\', '../../src/AppBundle/Controller') | |
->public() | |
->tag('controller.service_arguments'); | |
$s->set(ListUsersCommand::class) | |
->argument('$emailSender', '%app.notifications.email_sender%'); | |
$s->set(AppExtension::class) | |
->argument('$locales', '%app_locales%'); | |
$s->set(CommentNotificationSubscriber::class) | |
->argument('$sender', '%app.notifications.email_sender%'); | |
$s->set(RedirectToPreferredLocaleSubscriber::class) | |
->argument('$locales', '%app_locales%') | |
->argument('$defaultLocale', '%locale%'); | |
$s->set(IntlExtension::class); | |
$s->alias('slugger', Slugger::class) | |
->public(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
_defaults: | |
autowire: true | |
autoconfigure: true | |
public: false | |
AppBundle\: | |
resource: '../../src/AppBundle/*' | |
exclude: '../../src/AppBundle/{Controller,Entity,Repository,Tests}' | |
AppBundle\Controller\: | |
resource: '../../src/AppBundle/Controller' | |
public: true | |
tags: ['controller.service_arguments'] | |
AppBundle\Command\ListUsersCommand: | |
arguments: | |
$emailSender: '%app.notifications.email_sender%' | |
AppBundle\Twig\AppExtension: | |
$locales: '%app_locales%' | |
AppBundle\EventListener\CommentNotificationSubscriber: | |
$sender: '%app.notifications.email_sender%' | |
AppBundle\EventListener\RedirectToPreferredLocaleSubscriber: | |
$locales: '%app_locales%' | |
$defaultLocale: '%locale%' | |
Twig\Extensions\IntlExtension: ~ | |
slugger: | |
alias: AppBundle\Utils\Slugger | |
public: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment