1 |
efrain |
1 |
# Change log
|
|
|
2 |
|
|
|
3 |
## 6.1.0
|
|
|
4 |
|
|
|
5 |
- [#791](https://github.com/PHP-DI/PHP-DI/issues/791) Support PHP 8.1, remove support for PHP 7.2
|
|
|
6 |
|
|
|
7 |
## 6.0.2
|
|
|
8 |
|
|
|
9 |
- Fix potential regression introduced when fixing [#582](https://github.com/PHP-DI/PHP-DI/issues/582)
|
|
|
10 |
|
|
|
11 |
## 6.0.1
|
|
|
12 |
|
|
|
13 |
- Fix [#526](https://github.com/PHP-DI/PHP-DI/issues/526): Support optional parameters in factories
|
|
|
14 |
- [#585](https://github.com/PHP-DI/PHP-DI/issues/585) Add support for PHP-Parser 4.0
|
|
|
15 |
- [#582](https://github.com/PHP-DI/PHP-DI/issues/582) Register `ContainerInterface` to point to the wrapper container if it was defined
|
|
|
16 |
|
|
|
17 |
## 6.0
|
|
|
18 |
|
|
|
19 |
This is the complete change log. You can also read the [migration guide](doc/migration/6.0.md) for upgrading or the [blog article](news/22-php-di-6-0-released.md) to see what's new.
|
|
|
20 |
|
|
|
21 |
Improvements:
|
|
|
22 |
|
|
|
23 |
- [#494](https://github.com/PHP-DI/PHP-DI/pull/494) The container can now be compiled for optimum performances in production
|
|
|
24 |
- [#294](https://github.com/PHP-DI/PHP-DI/issues/294), [#349](https://github.com/PHP-DI/PHP-DI/issues/349), [#449](https://github.com/PHP-DI/PHP-DI/pull/449): `DI\object()` has been replaced by more specific and less ambiguous helpers:
|
|
|
25 |
- `DI\create()` creates an object, overrides autowiring and previous definitions
|
|
|
26 |
- `DI\autowire()` autowires an object and allows to override specific constructor and method parameters
|
|
|
27 |
- The container can now be built without parameters: `new Container()`
|
|
|
28 |
- Definitions can be nested:
|
|
|
29 |
- [#490](https://github.com/PHP-DI/PHP-DI/issues/490) Definitions can be nested in arrays (by [@yuloh](https://github.com/yuloh))
|
|
|
30 |
- [#501](https://github.com/PHP-DI/PHP-DI/issues/501) & [#540](https://github.com/PHP-DI/PHP-DI/issues/540) Autowire definitions can be nested in other definitions
|
|
|
31 |
- [#487](https://github.com/PHP-DI/PHP-DI/issues/487) & [#540](https://github.com/PHP-DI/PHP-DI/issues/540) Closures are now handled as factories when they are nested in other definitions
|
|
|
32 |
- [#487](https://github.com/PHP-DI/PHP-DI/issues/487) Closures in the config are now always interpreted as factories, even when nested inside other definitions
|
|
|
33 |
- [#242](https://github.com/PHP-DI/PHP-DI/issues/242) Error in case a definition is not indexed by a string
|
|
|
34 |
- [#505](https://github.com/PHP-DI/PHP-DI/pull/505) Debug container entries
|
|
|
35 |
- [#564](https://github.com/PHP-DI/PHP-DI/pull/564) Caching was made almost entirely obsolete by the container compilation, however there is still a caching system entirely rebuilt over APCu for covering the last cases that compilation could not address (see [php-di.org/doc/performances.html](https://php-di.org/doc/performances.html))
|
|
|
36 |
|
|
|
37 |
Fixes:
|
|
|
38 |
|
|
|
39 |
- [#499](https://github.com/PHP-DI/PHP-DI/issues/499) & [#488](https://github.com/PHP-DI/PHP-DI/issues/488) Standardize resolution of nested definitions everywhere.
|
|
|
40 |
In PHP-DI 5, definitions could be nested in some places (e.g. use a get() in an object definition, etc.). However it did not behave everywhere the same, for example it didn't work for sub-definitions in arrays.
|
|
|
41 |
Now in PHP-DI 6 all nested definitions will all be recognized and resolved correctly everywhere. Since #494 (compiled container) performance will not be affected so we can implement a more robust behavior.
|
|
|
42 |
- [#343](https://github.com/PHP-DI/PHP-DI/issues/343) Autowiring and Annotations do not work for `object()` inside arrays: it now works with the new `create()` and `autowire()` helpers
|
|
|
43 |
|
|
|
44 |
BC breaks:
|
|
|
45 |
|
|
|
46 |
- PHP 7 or greater is required and HHVM is no longer supported
|
|
|
47 |
- `DI\object()` has been removed, use `DI\create()` or `DI\autowire()` instead
|
|
|
48 |
- [#409](https://github.com/PHP-DI/PHP-DI/issues/409): Scopes are removed, read more in the [scopes](doc/scopes.md) documentation.
|
|
|
49 |
- Caching was replaced by compiling the container: `ContainerBuilder::setDefinitionCache()` was removed, use `ContainerBuilder::enableCompilation()` instead.
|
|
|
50 |
- [#463](https://github.com/PHP-DI/PHP-DI/issues/463) & [#485](https://github.com/PHP-DI/PHP-DI/issues/485): Container-interop support was removed, PSR-11 is used instead (by [@juliangut](https://github.com/juliangut))
|
|
|
51 |
- The deprecated `DI\link()` helper was removed, used `DI\get()` instead
|
|
|
52 |
- [#484](https://github.com/PHP-DI/PHP-DI/pull/484) The deprecated `\DI\Debug` class has been removed. Definitions can be cast to string directly
|
|
|
53 |
- The exception `DI\Definition\Exception\DefinitionException` was renamed to `DI\Definition\Exception\InvalidDefinition`
|
|
|
54 |
- The exception `DI\Definition\Exception\AnnotationException` was renamed to `DI\Definition\Exception\InvalidAnnotation`
|
|
|
55 |
- [#516](https://github.com/PHP-DI/PHP-DI/issues/516) `DI\InvokerInterface` was removed in favor of `Invoker\InvokerInterface`.
|
|
|
56 |
|
|
|
57 |
Be also aware that internal classes or interfaces may have changed.
|
|
|
58 |
|
|
|
59 |
## 5.4.6
|
|
|
60 |
|
|
|
61 |
- Fix [#554](https://github.com/PHP-DI/PHP-DI/issues/554): `Container::make()` fails when combined with `decorate()`.
|
|
|
62 |
|
|
|
63 |
## 5.4.5
|
|
|
64 |
|
|
|
65 |
Fixup of 5.4.4.
|
|
|
66 |
|
|
|
67 |
- [#531](https://github.com/PHP-DI/PHP-DI/issues/531): performance improvement.
|
|
|
68 |
|
|
|
69 |
## 5.4.4
|
|
|
70 |
|
|
|
71 |
This release was broken because it was tagged against the wrong branch.
|
|
|
72 |
|
|
|
73 |
- [#531](https://github.com/PHP-DI/PHP-DI/issues/531): performance improvement.
|
|
|
74 |
|
|
|
75 |
## 5.4.3
|
|
|
76 |
|
|
|
77 |
- [#467](https://github.com/PHP-DI/PHP-DI/issues/467): register the container against the PSR ContainerInterface
|
|
|
78 |
|
|
|
79 |
## 5.4.2
|
|
|
80 |
|
|
|
81 |
- Minor patch to add the `provide: psr/container-implementation` to `composer.json`.
|
|
|
82 |
|
|
|
83 |
## 5.4.1
|
|
|
84 |
|
|
|
85 |
- [PSR-11](http://www.php-fig.org/psr/) compliance
|
|
|
86 |
|
|
|
87 |
Note that PHP-DI was already compliant with PSR-11 because it was implementing container-interop, and container-interop 1.2 extends PSR-11. This new version just makes it more explicit and will allow to drop container-interop support in the next major versions.
|
|
|
88 |
|
|
|
89 |
## 5.4
|
|
|
90 |
|
|
|
91 |
Read the [news entry](news/20-php-di-5-4-released.md).
|
|
|
92 |
|
|
|
93 |
New features:
|
|
|
94 |
|
|
|
95 |
- [#362](https://github.com/PHP-DI/PHP-DI/issues/362) implemented in [#428](https://github.com/PHP-DI/PHP-DI/pull/428), [#430](https://github.com/PHP-DI/PHP-DI/pull/430), [#431](https://github.com/PHP-DI/PHP-DI/pull/431) and [#432](https://github.com/PHP-DI/PHP-DI/pull/432): factory parameters can now be configured, for example:
|
|
|
96 |
```php
|
|
|
97 |
return [
|
|
|
98 |
'Database' => DI\factory(function ($host) {...})
|
|
|
99 |
->parameter('host', DI\get('db.host')),
|
|
|
100 |
];
|
|
|
101 |
```
|
|
|
102 |
Read the [factories documentation](https://php-di.org/doc/php-definitions.html#factories) to learn more. Feature implemented by [@predakanga](https://github.com/predakanga).
|
|
|
103 |
|
|
|
104 |
Improvements:
|
|
|
105 |
|
|
|
106 |
- [#429](https://github.com/PHP-DI/PHP-DI/pull/429): performance improvements in definition resolution (by [@mnapoli](https://github.com/mnapoli))
|
|
|
107 |
- [#421](https://github.com/PHP-DI/PHP-DI/issues/421): once a `ContainerBuilder` has built a container, it is locked to prevent confusion when adding new definitions to it (by [@mnapoli](https://github.com/mnapoli))
|
|
|
108 |
- [#423](https://github.com/PHP-DI/PHP-DI/pull/423): improved exception messages (by [@mnapoli](https://github.com/mnapoli))
|
|
|
109 |
|
|
|
110 |
## 5.3
|
|
|
111 |
|
|
|
112 |
Read the [news entry](news/19-php-di-5-3-released.md).
|
|
|
113 |
|
|
|
114 |
- release of the [2.0 version](https://github.com/PHP-DI/Symfony-Bridge/releases/tag/2.0.0) of the Symfony bridge (by [@mnapoli](https://github.com/mnapoli))
|
|
|
115 |
- PHP 5.5 or above is now required
|
|
|
116 |
- a lot of documentation improvements by 9 different contributors
|
|
|
117 |
- [#389](https://github.com/PHP-DI/PHP-DI/pull/389): exception message improvement by [@mopahle](https://github.com/mopahle)
|
|
|
118 |
- [#359](https://github.com/PHP-DI/PHP-DI/issues/359), [#411](https://github.com/PHP-DI/PHP-DI/issues/411), [#414](https://github.com/PHP-DI/PHP-DI/pull/414), [#412](https://github.com/PHP-DI/PHP-DI/pull/412): compatibility with ProxyManager 1.* and 2.* (by [@holtkamp](https://github.com/holtkamp) and [@mnapoli](https://github.com/mnapoli))
|
|
|
119 |
- [#416](https://github.com/PHP-DI/PHP-DI/pull/416): dumping definitions was refactored into a more lightweight and simple solution; definition "dumpers" have been removed (internal classes), definitions can now be cast to string directly (by [@mnapoli](https://github.com/mnapoli))
|
|
|
120 |
|
|
|
121 |
## 5.2
|
|
|
122 |
|
|
|
123 |
Read the [news entry](news/17-php-di-5-2-released.md).
|
|
|
124 |
|
|
|
125 |
Improvements:
|
|
|
126 |
|
|
|
127 |
- [#347](https://github.com/PHP-DI/PHP-DI/pull/347) (includes [#333](https://github.com/PHP-DI/PHP-DI/pull/333) and [#345](https://github.com/PHP-DI/PHP-DI/pull/345)): by [@jdreesen](https://github.com/jdreesen), [@quimcalpe](https://github.com/quimcalpe) and [@mnapoli](https://github.com/mnapoli)
|
|
|
128 |
- Allow injection of any container object as factory parameter via type hinting
|
|
|
129 |
- Allow injection of a `DI\Factory\RequestedEntry` object to get the requested entry name
|
|
|
130 |
- [#272](https://github.com/PHP-DI/PHP-DI/issues/272): Support `"Class::method""` syntax for callables (by [@jdreesen](https://github.com/jdreesen))
|
|
|
131 |
- [#332](https://github.com/PHP-DI/PHP-DI/issues/332): IDE support (plugin and documentation) (by [@pulyaevskiy](https://github.com/pulyaevskiy), [@avant1](https://github.com/avant1) and [@mnapoli](https://github.com/mnapoli))
|
|
|
132 |
- [#326](https://github.com/PHP-DI/PHP-DI/pull/326): Exception messages are simpler and more consistent (by [@mnapoli](https://github.com/mnapoli))
|
|
|
133 |
- [#325](https://github.com/PHP-DI/PHP-DI/pull/325): Add a "Edit this page" button in the website to encourage users to improve the documentation (by [@jdreesen](https://github.com/jdreesen))
|
|
|
134 |
|
|
|
135 |
Bugfixes:
|
|
|
136 |
|
|
|
137 |
- [#321](https://github.com/PHP-DI/PHP-DI/pull/321): Allow factory definitions to reference arbitrary container entries as callables (by [@jdreesen](https://github.com/jdreesen))
|
|
|
138 |
- [#335](https://github.com/PHP-DI/PHP-DI/issues/335): Class imports in traits are now considered when parsing annotations (by [@thebigb](https://github.com/thebigb))
|
|
|
139 |
|
|
|
140 |
## 5.1
|
|
|
141 |
|
|
|
142 |
Read the [news entry](news/16-php-di-5-1-released.md).
|
|
|
143 |
|
|
|
144 |
Improvements:
|
|
|
145 |
|
|
|
146 |
- [Zend Framework 2 integration](https://github.com/PHP-DI/ZF2-Bridge) (by @Rastusik)
|
|
|
147 |
- [#308](https://github.com/PHP-DI/PHP-DI/pull/308): Instantiate factories using the container (`DI\factory(['FooFactory', 'create'])`)
|
|
|
148 |
- Many performances improvements - some benchmarks show up to 35% performance improvements, real results may vary of course
|
|
|
149 |
- Many documentation improvements (@jdreesen, @mindplay-dk, @mnapoli, @holtkamp, @Rastusik)
|
|
|
150 |
- [#296](https://github.com/PHP-DI/PHP-DI/issues/296): Provide a faster `ArrayCache` implementation, mostly useful in micro-benchmarks
|
|
|
151 |
|
|
|
152 |
Bugfixes:
|
|
|
153 |
|
|
|
154 |
- [#257](https://github.com/PHP-DI/PHP-DI/issues/257) & [#274](https://github.com/PHP-DI/PHP-DI/issues/274): Private properties of parent classes are not injected when using annotations
|
|
|
155 |
- [#300](https://github.com/PHP-DI/PHP-DI/pull/300): Exception if object definition extends an incompatible definition
|
|
|
156 |
- [#306](https://github.com/PHP-DI/PHP-DI/issues/306): Errors when using parameters passed by reference (fixed by @bradynpoulsen)
|
|
|
157 |
- [#318](https://github.com/PHP-DI/PHP-DI/issues/318): `Container::call()` ignores parameter's default value
|
|
|
158 |
|
|
|
159 |
Internal changes:
|
|
|
160 |
|
|
|
161 |
- [#276](https://github.com/PHP-DI/PHP-DI/pull/276): Tests now pass on Windows (@bgaillard)
|
|
|
162 |
|
|
|
163 |
## 5.0
|
|
|
164 |
|
|
|
165 |
This is the complete change log. You can also read the [migration guide](doc/migration/5.0.md) for upgrading, or [the news article](news/15-php-di-5-0-released.md) for a nicer introduction to this new version.
|
|
|
166 |
|
|
|
167 |
Improvements:
|
|
|
168 |
|
|
|
169 |
- Moved to an organization on GitHub: [github.com/PHP-DI/PHP-DI](https://github.com/PHP-DI/PHP-DI)
|
|
|
170 |
- The package has been renamed to: from `mnapoli/php-di` to [`php-di/php-di`](https://packagist.org/packages/php-di/php-di)
|
|
|
171 |
- New [Silex integration](doc/frameworks/silex.md)
|
|
|
172 |
- Lighter package: from 10 to 3 Composer dependencies!
|
|
|
173 |
- [#235](https://github.com/PHP-DI/PHP-DI/issues/235): `DI\link()` is now deprecated in favor of `DI\get()`. There is no BC break as `DI\link()` still works.
|
|
|
174 |
- [#207](https://github.com/PHP-DI/PHP-DI/issues/207): Support for `DI\link()` in arrays
|
|
|
175 |
- [#203](https://github.com/PHP-DI/PHP-DI/issues/203): New `DI\string()` helper ([documentation](doc/php-definitions.md))
|
|
|
176 |
- [#208](https://github.com/PHP-DI/PHP-DI/issues/208): Support for nested definitions
|
|
|
177 |
- [#226](https://github.com/PHP-DI/PHP-DI/pull/226): `DI\factory()` can now be omitted with closures:
|
|
|
178 |
|
|
|
179 |
```php
|
|
|
180 |
// before
|
|
|
181 |
'My\Class' => DI\factory(function () { ... })
|
|
|
182 |
// now (optional shortcut)
|
|
|
183 |
'My\Class' => function () { ... }
|
|
|
184 |
```
|
|
|
185 |
- [#193](https://github.com/PHP-DI/PHP-DI/issues/193): `DI\object()->method()` now supports calling the same method twice (or more).
|
|
|
186 |
- [#248](https://github.com/PHP-DI/PHP-DI/issues/248): New `DI\decorate()` helper to decorate a previously defined entry ([documentation](doc/definition-overriding.md))
|
|
|
187 |
- [#215](https://github.com/PHP-DI/PHP-DI/pull/215): New `DI\add()` helper to add entries to an existing array ([documentation](doc/definition-overriding.md))
|
|
|
188 |
- [#218](https://github.com/PHP-DI/PHP-DI/issues/218): `ContainerBuilder::addDefinitions()` can now take an array of definitions
|
|
|
189 |
- [#211](https://github.com/PHP-DI/PHP-DI/pull/211): `ContainerBuilder::addDefinitions()` is now fluent (return `$this`)
|
|
|
190 |
- [#250](https://github.com/PHP-DI/PHP-DI/issues/250): `Container::call()` now also accepts parameters not indexed by name as well as embedded definitions ([documentation](doc/container.md))
|
|
|
191 |
- Various performance improvements, e.g. lower the number of files loaded, simpler architecture, …
|
|
|
192 |
|
|
|
193 |
BC breaks:
|
|
|
194 |
|
|
|
195 |
- PHP-DI now requires a version of PHP >= 5.4.0
|
|
|
196 |
- The package is lighter by default:
|
|
|
197 |
- [#251](https://github.com/PHP-DI/PHP-DI/issues/251): Annotations are disabled by default, if you use annotations enable them with `$containerBuilder->useAnnotations(true)`. Additionally the `doctrine/annotations` package isn't required by default anymore, so you also need to run `composer require doctrine/annotations`.
|
|
|
198 |
- `doctrine/cache` is not installed by default anymore, you need to require it in `composer.json` (`~1.0`) if you want to configure a cache for PHP-DI
|
|
|
199 |
- [#198](https://github.com/PHP-DI/PHP-DI/issues/198): `ocramius/proxy-manager` is not installed by default anymore, you need to require it in `composer.json` (`~1.0`) if you want to use **lazy injection**
|
|
|
200 |
- Closures are now converted into factory definitions automatically. If you ever defined a closure as a value (e.g. to have the closure injected in a class), you need to wrap the closure with the new `DI\value()` helper.
|
|
|
201 |
- [#223](https://github.com/PHP-DI/PHP-DI/issues/223): `DI\ContainerInterface` was deprecated since v4.1 and has been removed
|
|
|
202 |
|
|
|
203 |
Internal changes in case you were replacing/extending some parts:
|
|
|
204 |
|
|
|
205 |
- the definition sources architecture has been refactored, if you defined custom definition sources you will need to update your code (it should be much easier now)
|
|
|
206 |
- [#252](https://github.com/PHP-DI/PHP-DI/pull/252): `DI\Scope` internal implementation has changed. You are encouraged to use the constants (`DI\Scope::SINGLETON` and `DI\Scope::PROTOTYPE`) instead of the static methods, but backward compatibility is kept (static methods still work).
|
|
|
207 |
- [#241](https://github.com/PHP-DI/PHP-DI/issues/241): `Container::call()` now uses the *Invoker* external library
|
|
|
208 |
|
|
|
209 |
## 4.4
|
|
|
210 |
|
|
|
211 |
Read the [news entry](news/13-php-di-4-4-released.md).
|
|
|
212 |
|
|
|
213 |
- [#185](https://github.com/PHP-DI/PHP-DI/issues/185) Support for invokable objects in `Container::call()`
|
|
|
214 |
- [#192](https://github.com/PHP-DI/PHP-DI/pull/192) Support for invokable classes in `Container::call()` (will instantiate the class)
|
|
|
215 |
- [#184](https://github.com/PHP-DI/PHP-DI/pull/184) Option to ignore phpdoc errors
|
|
|
216 |
|
|
|
217 |
## 4.3
|
|
|
218 |
|
|
|
219 |
Read the [news entry](news/11-php-di-4-3-released.md).
|
|
|
220 |
|
|
|
221 |
- [#176](https://github.com/PHP-DI/PHP-DI/pull/176) New definition type for reading environment variables: `DI\env()`
|
|
|
222 |
- [#181](https://github.com/PHP-DI/PHP-DI/pull/181) `DI\FactoryInterface` and `DI\InvokerInterface` are now auto-registered inside the container so that you can inject them without any configuration needed
|
|
|
223 |
- [#173](https://github.com/PHP-DI/PHP-DI/pull/173) `$container->call(['MyClass', 'method]);` will get `MyClass` from the container if `method()` is not a static method
|
|
|
224 |
|
|
|
225 |
## 4.2.2
|
|
|
226 |
|
|
|
227 |
- Fixed [#180](https://github.com/PHP-DI/PHP-DI/pull/180): `Container::call()` with object methods (`[$object, 'method']`) is now supported
|
|
|
228 |
|
|
|
229 |
## 4.2.1
|
|
|
230 |
|
|
|
231 |
- Support for PHP 5.3.3, which was previously incomplete because of a bug in the reflection (there is now a workaround for this bug)
|
|
|
232 |
|
|
|
233 |
But if you can, seriously avoid this (really old) PHP version and upgrade.
|
|
|
234 |
|
|
|
235 |
## 4.2
|
|
|
236 |
|
|
|
237 |
Read the [news entry](news/10-php-di-4-2-released.md).
|
|
|
238 |
|
|
|
239 |
**Minor BC-break**: Optional parameters (that were not configured) were injected, they are now ignored, which is what naturally makes sense since they are optional.
|
|
|
240 |
Example:
|
|
|
241 |
|
|
|
242 |
```php
|
|
|
243 |
public function __construct(Bar $bar = null)
|
|
|
244 |
{
|
|
|
245 |
$this->bar = $bar ?: $this->createDefaultBar();
|
|
|
246 |
}
|
|
|
247 |
```
|
|
|
248 |
|
|
|
249 |
Before 4.2, PHP-DI would try to inject a `Bar` instance. From 4.2 and onwards, it will inject `null`.
|
|
|
250 |
|
|
|
251 |
Of course, you can still explicitly define an injection for the optional parameters and that will work.
|
|
|
252 |
|
|
|
253 |
All changes:
|
|
|
254 |
|
|
|
255 |
* [#162](https://github.com/PHP-DI/PHP-DI/pull/162) Added `Container::call()` to call functions with dependency injection
|
|
|
256 |
* [#156](https://github.com/PHP-DI/PHP-DI/issues/156) Wildcards (`*`) in definitions
|
|
|
257 |
* [#164](https://github.com/PHP-DI/PHP-DI/issues/164) Prototype scope is now available for `factory()` definitions too
|
|
|
258 |
* FIXED [#168](https://github.com/PHP-DI/PHP-DI/pull/168) `Container::has()` now returns false for interfaces and abstract classes that are not mapped in the definitions
|
|
|
259 |
* FIXED [#171](https://github.com/PHP-DI/PHP-DI/issues/171) Optional parameters are now ignored (not injected) if not set in the definitions (see the BC-break warning above)
|
|
|
260 |
|
|
|
261 |
## 4.1
|
|
|
262 |
|
|
|
263 |
Read the [news entry](news/09-php-di-4-1-released.md).
|
|
|
264 |
|
|
|
265 |
BC-breaks: None.
|
|
|
266 |
|
|
|
267 |
* [#138](https://github.com/PHP-DI/PHP-DI/issues/138) [Container-interop](https://github.com/container-interop/container-interop) compliance
|
|
|
268 |
* [#143](https://github.com/PHP-DI/PHP-DI/issues/143) Much more explicit exception messages
|
|
|
269 |
* [#157](https://github.com/PHP-DI/PHP-DI/issues/157) HHVM support
|
|
|
270 |
* [#158](https://github.com/PHP-DI/PHP-DI/issues/158) Improved the documentation for [Symfony 2 integration](https://php-di.org/doc/frameworks/symfony2.html)
|
|
|
271 |
|
|
|
272 |
## 4.0
|
|
|
273 |
|
|
|
274 |
Major changes:
|
|
|
275 |
|
|
|
276 |
* The configuration format has changed ([read more here to understand why](news/06-php-di-4-0-new-definitions.md))
|
|
|
277 |
|
|
|
278 |
Read the migration guide if you are using 3.x: [Migration guide from 3.x to 4.0](doc/migration/4.0.md).
|
|
|
279 |
|
|
|
280 |
BC-breaks:
|
|
|
281 |
|
|
|
282 |
* YAML, XML and JSON definitions have been removed, and the PHP definition format has changed (see above)
|
|
|
283 |
* `ContainerSingleton` has been removed
|
|
|
284 |
* You cannot configure an injection as lazy anymore, you can only configure a container entry as lazy
|
|
|
285 |
* The Container constructor now takes mandatory parameters. Use the ContainerBuilder to create a Container.
|
|
|
286 |
* Removed `ContainerBuilder::setDefinitionsValidation()` (no definition validation anymore)
|
|
|
287 |
* `ContainerBuilder::useReflection()` is now named: `ContainerBuilder::useAutowiring()`
|
|
|
288 |
* `ContainerBuilder::addDefinitionsFromFile()` is now named: `ContainerBuilder::addDefinitions()`
|
|
|
289 |
* The `$proxy` parameter in `Container::get($name, $proxy = true)` hase been removed. To get a proxy, you now need to define an entry as "lazy".
|
|
|
290 |
|
|
|
291 |
Other changes:
|
|
|
292 |
|
|
|
293 |
* Added `ContainerInterface` and `FactoryInterface`, both implemented by the container.
|
|
|
294 |
* [#115](https://github.com/PHP-DI/PHP-DI/issues/115) Added `Container::has()`
|
|
|
295 |
* [#142](https://github.com/PHP-DI/PHP-DI/issues/142) Added `Container::make()` to resolve an entry
|
|
|
296 |
* [#127](https://github.com/PHP-DI/PHP-DI/issues/127) Added support for cases where PHP-DI is wrapped by another container (like Acclimate): PHP-DI can now use the wrapping container to perform injections
|
|
|
297 |
* [#128](https://github.com/PHP-DI/PHP-DI/issues/128) Configure entry aliases
|
|
|
298 |
* [#110](https://github.com/PHP-DI/PHP-DI/issues/110) XML definitions are not supported anymore
|
|
|
299 |
* [#122](https://github.com/PHP-DI/PHP-DI/issues/122) JSON definitions are not supported anymore
|
|
|
300 |
* `ContainerSingleton` has finally been removed
|
|
|
301 |
* Added `ContainerBuilder::buildDevContainer()` to get started with a default container very easily.
|
|
|
302 |
* [#99](https://github.com/PHP-DI/PHP-DI/issues/99) Fixed "`@param` with PHP internal type throws exception"
|
|
|
303 |
|
|
|
304 |
## 3.5.1
|
|
|
305 |
|
|
|
306 |
* FIXED [#126](https://github.com/PHP-DI/PHP-DI/issues/126): `Container::set` without effect if a value has already been set and retrieved
|
|
|
307 |
|
|
|
308 |
## 3.5
|
|
|
309 |
|
|
|
310 |
Read the [news entry](news/05-php-di-3-5.md).
|
|
|
311 |
|
|
|
312 |
* Importing `@Inject` and `@Injectable` annotations is now optional! It means that you don't have to write `use DI\Annotation\Inject` anymore
|
|
|
313 |
* FIXED [#124](https://github.com/PHP-DI/PHP-DI/issues/124): `@Injects` annotation conflicts with other annotations
|
|
|
314 |
|
|
|
315 |
## 3.4
|
|
|
316 |
|
|
|
317 |
Read the [news entry](news/04-php-di-3-4.md).
|
|
|
318 |
|
|
|
319 |
* [#106](https://github.com/PHP-DI/PHP-DI/pull/106) You can now define arrays of values (in YAML, PHP, …) thanks to [@unkind](https://github.com/unkind)
|
|
|
320 |
* [#98](https://github.com/PHP-DI/PHP-DI/issues/98) `ContainerBuilder` is now fluent thanks to [@drdamour](https://github.com/drdamour)
|
|
|
321 |
* [#101](https://github.com/PHP-DI/PHP-DI/pull/101) Optional parameters are now supported: if you don't define a value to inject, their default value will be used
|
|
|
322 |
* XML definitions have been deprecated, there weren't even documented and were not maintained. They will be removed in 4.0.
|
|
|
323 |
* FIXED [#100](https://github.com/PHP-DI/PHP-DI/issues/100): bug for lazy injection in constructors
|
|
|
324 |
|
|
|
325 |
## 3.3
|
|
|
326 |
|
|
|
327 |
Read the [news entry](news/03-php-di-3-3.md).
|
|
|
328 |
|
|
|
329 |
* Inject dependencies on an existing instance with `Container::injectOn` (work from [Jeff Flitton](https://github.com/jflitton): [#89](https://github.com/PHP-DI/PHP-DI/pull/89)).
|
|
|
330 |
* [#86](https://github.com/PHP-DI/PHP-DI/issues/86): Optimized definition lookup (faster)
|
|
|
331 |
* FIXED [#87](https://github.com/PHP-DI/PHP-DI/issues/87): Rare bug in the `PhpDocParser`, fixed by [drdamour](https://github.com/drdamour)
|
|
|
332 |
|
|
|
333 |
## 3.2
|
|
|
334 |
|
|
|
335 |
Read the [news entry](news/02-php-di-3-2.md).
|
|
|
336 |
|
|
|
337 |
Small BC-break: PHP-DI 3.0 and 3.1 injected properties before calling the constructor. This was confusing and [not supported for internal classes](https://github.com/PHP-DI/PHP-DI/issues/74).
|
|
|
338 |
From 3.2 and on, properties are injected after calling the constructor.
|
|
|
339 |
|
|
|
340 |
* **[Lazy injection](doc/lazy-injection.md)**: it is now possible to use lazy injection on properties and methods (setters and constructors).
|
|
|
341 |
* Lazy dependencies are now proxies that extend the class they proxy, so type-hinting works.
|
|
|
342 |
* Addition of the **`ContainerBuilder`** object, that helps to [create and configure a `Container`](doc/container-configuration.md).
|
|
|
343 |
* Some methods for configuring the Container have gone **deprecated** in favor of the `ContainerBuilder`. Fear not, these deprecated methods will remain until next major version (4.0).
|
|
|
344 |
* `Container::useReflection`, use ContainerBuilder::useReflection instead
|
|
|
345 |
* `Container::useAnnotations`, use ContainerBuilder::useAnnotations instead
|
|
|
346 |
* `Container::setDefinitionCache`, use ContainerBuilder::setDefinitionCache instead
|
|
|
347 |
* `Container::setDefinitionsValidation`, use ContainerBuilder::setDefinitionsValidation instead
|
|
|
348 |
* The container is now auto-registered (as 'DI\Container'). You can now inject the container without registering it.
|
|
|
349 |
|
|
|
350 |
## 3.1.1
|
|
|
351 |
|
|
|
352 |
* Value definitions (`$container->set('foo', 80)`) are not cached anymore
|
|
|
353 |
* FIXED [#82](https://github.com/PHP-DI/PHP-DI/issues/82): Serialization error when using a cache
|
|
|
354 |
|
|
|
355 |
## 3.1
|
|
|
356 |
|
|
|
357 |
Read the [news entry](news/01-php-di-3-1.md).
|
|
|
358 |
|
|
|
359 |
* Zend Framework 1 integration through the [PHP-DI-ZF1 project](https://github.com/PHP-DI/PHP-DI-ZF1)
|
|
|
360 |
* Fixed the order of priorities when you mix different definition sources (reflection, annotations, files, …). See [Definition overriding](doc/definition-overriding.md)
|
|
|
361 |
* Now possible to define null values with `$container->set('foo', null)` (see [#79](https://github.com/PHP-DI/PHP-DI/issues/79)).
|
|
|
362 |
* Deprecated usage of `ContainerSingleton`, will be removed in next major version (4.0)
|
|
|
363 |
|
|
|
364 |
## 3.0.6
|
|
|
365 |
|
|
|
366 |
* FIXED [#76](https://github.com/PHP-DI/PHP-DI/issues/76): Definition conflict when setting a closure for a class name
|
|
|
367 |
|
|
|
368 |
## 3.0.5
|
|
|
369 |
|
|
|
370 |
* FIXED [#70](https://github.com/PHP-DI/PHP-DI/issues/70): Definition conflict when setting a value for a class name
|
|
|
371 |
|
|
|
372 |
## 3.0.4
|
|
|
373 |
|
|
|
374 |
* FIXED [#69](https://github.com/PHP-DI/PHP-DI/issues/69): YamlDefinitionFileLoader crashes if YAML file is empty
|
|
|
375 |
|
|
|
376 |
## 3.0.3
|
|
|
377 |
|
|
|
378 |
* Fixed over-restrictive dependencies in composer.json
|
|
|
379 |
|
|
|
380 |
## 3.0.2
|
|
|
381 |
|
|
|
382 |
* [#64](https://github.com/PHP-DI/PHP-DI/issues/64): Non PHP-DI exceptions are not captured-rethrown anymore when injecting dependencies (cleaner stack trace)
|
|
|
383 |
|
|
|
384 |
## 3.0.1
|
|
|
385 |
|
|
|
386 |
* [#62](https://github.com/PHP-DI/PHP-DI/issues/62): When using aliases, definitions are now merged
|
|
|
387 |
|
|
|
388 |
## 3.0
|
|
|
389 |
|
|
|
390 |
Major compatibility breaks with 2.x.
|
|
|
391 |
|
|
|
392 |
* The container is no longer a Singleton (but `ContainerSingleton::getInstance()` is available for fools who like it)
|
|
|
393 |
* Setter injection
|
|
|
394 |
* Constructor injection
|
|
|
395 |
* Scopes: singleton (share the same instance of the class) or prototype (create a new instance each time it is fetched). Defined at class level.
|
|
|
396 |
* Configuration is reworked from scratch. Now every configuration backend can do 100% of the job.
|
|
|
397 |
* Provided configuration backends:
|
|
|
398 |
* Reflection
|
|
|
399 |
* Annotations: @Inject, @Injectable
|
|
|
400 |
* PHP code (`Container::set()`)
|
|
|
401 |
* PHP array
|
|
|
402 |
* YAML file
|
|
|
403 |
* As a consequence, annotations are not mandatory anymore, all functionalities can be used with or without annotations.
|
|
|
404 |
* Renamed `DI\Annotations\` to `DI\Annotation\`
|
|
|
405 |
* `Container` no longer implements ArrayAccess, use only `$container->get($key)` now
|
|
|
406 |
* ZF1 integration broken and removed (work in progress for next releases)
|
|
|
407 |
* Code now follows PSR1 and PSR2 coding styles
|
|
|
408 |
* FIXED: [#58](https://github.com/PHP-DI/PHP-DI/issues/58) Getting a proxy of an alias didn't work
|
|
|
409 |
|
|
|
410 |
## 2.1
|
|
|
411 |
|
|
|
412 |
* `use` statements to import classes from other namespaces are now taken into account with the `@var` annotation
|
|
|
413 |
* Updated and lightened the dependencies : `doctrine/common` has been replaced with more specific `doctrine/annotations` and `doctrine/cache`
|
|
|
414 |
|
|
|
415 |
## 2.0
|
|
|
416 |
|
|
|
417 |
Major compatibility breaks with 1.x.
|
|
|
418 |
|
|
|
419 |
* `Container::resolveDependencies()` has been renamed to `Container::injectAll()`
|
|
|
420 |
* Dependencies are now injected **before** the constructor is called, and thus are available in the constructor
|
|
|
421 |
* Merged `@Value` annotation with `@Inject`: no difference between value and bean injection anymore
|
|
|
422 |
* Container implements ArrayAccess for get() and set() (`$container['db.host'] = 'localhost';`)
|
|
|
423 |
* Ini configuration files removed: configuration is done in PHP
|
|
|
424 |
* Allow to define beans within closures for lazy-loading
|
|
|
425 |
* Switched to MIT License
|
|
|
426 |
|
|
|
427 |
Warning:
|
|
|
428 |
|
|
|
429 |
* If you use PHP 5.3 and __wakeup() methods, they will be called when PHP-DI creates new instances of those classes.
|
|
|
430 |
|
|
|
431 |
## 1.1
|
|
|
432 |
|
|
|
433 |
* Caching of annotations based on Doctrine caches
|
|
|
434 |
|
|
|
435 |
## 1.0
|
|
|
436 |
|
|
|
437 |
* DependencyManager renamed to Container
|
|
|
438 |
* Refactored basic Container usage with `get` and `set`
|
|
|
439 |
* Allow named injection `@Inject(name="")`
|
|
|
440 |
* Zend Framework integration
|