-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome_modules.twig
68 lines (48 loc) · 1.51 KB
/
home_modules.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<div id="modules" class='container'>
<h2><a href="#modules">Scales with your application</a></h2>
<div class="row">
<div class='col-md-6'>
<h4>From simple applications</h4>
<p>
Just create the container and you are good to go thanks to autowiring.
</p>
<pre><code class="php">$container = ContainerBuilder::buildDevContainer();
$home = $container->get(HomeController::class);
</code></pre>
<p>
You can also define services à la Pimple:
</p>
<pre><code class="php">$container->set('db', new Database($options));
$container->set('logger', function () {
$logger = new Monolog\Logger();
$logger->pushHandler(new StreamHandler('app.log'));
return $logger;
});
$db = $container->get('db');
$logger = $container->get('logger');
</code></pre>
</div>
<div class='col-md-6'>
<h4>To complex and modular systems</h4>
<p>
Register as many configuration files as you want.
</p>
<pre><code class="php">// base config
return [
'notifiers' => [
get(EmailNotifier::class),
]
];</code></pre>
<p>
Use definition overriding to extend lists, decorate or replace previous entries…
</p>
<pre><code class="php">// module (aka bundle) config
return [
'notifiers' => add([
get(TextNotifier::class),
get(MobilePushNotifier::class),
])
];</code></pre>
</div>
</div>
</div>