Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 12b8570

Browse files
committed
Make changes according to @weierophinney
1 parent 8ae7a48 commit 12b8570

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

doc/book/container/aura-di.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,27 @@ $ composer require "aura/di:3.0.*@beta"
2828

2929
Aura.Di can help you to reorganize your code better with
3030
[ContainerConfig classes](http://auraphp.com/packages/Aura.Di/config.html) and
31-
[two step configuration](http://auraphp.com/blog/2014/04/07/two-stage-config/).
32-
33-
The bare minimal code needed to make zend-expressive work is
31+
[two step configuration](http://auraphp.com/blog/2014/04/07/two-stage-config/)
32+
in this example, we'll have that in `config/services.php`.
3433

3534
```php
3635
<?php
37-
// PROJECT_PATH/config/Common.php
38-
// Assuming you have added the autoload path
36+
use Aura\Di\ContainerBuilder;
37+
38+
$container_builder = new ContainerBuilder();
3939

40+
// use the builder to create and configure a container
41+
// using an array of ContainerConfig classes
42+
// make sure the classes can be autoloaded
43+
return $container_builder->newConfiguredInstance([
44+
'Application\_Config\Common',
45+
]);
46+
```
47+
48+
The bare minimal `ContainerConfig ` code needed to make zend-expressive work is
49+
50+
```php
51+
<?php
4052
namespace Application\_Config;
4153

4254
use Aura\Di\Container;
@@ -98,22 +110,9 @@ class Common extends ContainerConfig
98110
Your bootstrap (typically `public/index.php`) will then look like this:
99111

100112
```php
101-
<?php
102-
// PROJECT_PATH/public/index.php
103-
use Aura\Di\ContainerBuilder;
104-
105113
chdir(dirname(__DIR__));
106114
require 'vendor/autoload.php';
107-
108-
$container_builder = new ContainerBuilder();
109-
110-
// use the builder to create and configure a container
111-
// using an array of ContainerConfig classes
112-
$di = $container_builder->newConfiguredInstance([
113-
'Application\_Config\Common',
114-
]);
115-
116-
$app = $di->get('Zend\Expressive\Application');
117-
115+
$container = require 'config/services.php';
116+
$app = $container->get('Zend\Expressive\Application');
118117
$app->run();
119118
```

0 commit comments

Comments
 (0)