-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservices.php
55 lines (50 loc) · 1.48 KB
/
services.php
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
<?php
/**
* This file registeres the app's core services.
*
* Services are registered by using a closure which receives and returns the
* container.
*
* The Auryn container (with an adapted interface) is used as the IoC container.
* The container must implement \Duktig\Core\DI\ContainerInterface, which is an
* extension of the \Psr\Container\ContainerInterface.
*
* If necessary, these service definitions can be skipped all together in your
* app by using the @skipCoreServices config param.
*/
return function($container) {
/**
* Container service, singleton
*/
$container->alias(
\Duktig\Core\DI\ContainerInterface::class,
\Duktig\DI\Adapter\Auryn\AurynAdapter::class
);
$container->singleton($container);
/**
* Config service, singleton
*/
$container->alias(
\Duktig\Core\Config\ConfigInterface::class,
\Duktig\Core\Config\Config::class
);
$container->singleton(\Duktig\Core\Config\ConfigInterface::class);
/**
* Exception handler
*/
$container->factory(
\Duktig\Core\Exception\Handler\HandlerInterface::class,
function(\Duktig\Core\Exception\Handler\Handler $handler) {
$handler->register();
return $handler;
}
);
/**
* Response sender
*/
$container->alias(
\Duktig\Core\Http\ResponseSenderInterface::class,
\Duktig\Core\Http\ResponseSender::class
);
return $container;
};