-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Description
With the PHP configuration format, it's possible to set PHP objects (while Yaml has restricted types, extended using tags).
Benefit: define service directly in the configuration, so that they are colocated.
That would also enable other types of objects; each node allowing a list of class names.
Example
In framework.cache.pools.*.adapter, the config node only accepts a string for the service Id.
It could accept a Reference:
return App::config([
'framework' => [
'cache' => [
'pools' => [
'cache.mycache' => [
- 'adapter' => 'cache.adapter.redis',
+ 'adapter' => reference('cache.adapter.redis'),
'default_lifetime' => 3600,
],
],
],
],
]);Or inline service Definition:
return App::config([
'framework' => [
'cache' => [
'pools' => [
'cache.mycache' => [
- 'adapter' => 'cache.adapter.redis',
+ 'adapter' => inline_service(RedisAdapter::class)->...,
'default_lifetime' => 3600,
],
],
],
],
]);The configuration tree would be like this:
->prototype(['string', Definition::class, Reference::class])