ELPHIN.COM
Updated 778 days ago
In this post, I illustrate how Symfony's Expression Languange can be used to dynamically configure services at runtime, and also show how to replace the Doctrine bundle's ConnectionFactory to provide very robust discovery of a database at runtime...
Since Symfony 2.4, the Expression Language provides the means to configure services with expressions. It can do a lot more besides that - see the cookbook for examples - but I'll focus on how it can be used for runtime configuration discovery...
In a production environment, you'll probably want to cache the discovered configuration with a short TTL. It depends how fast your discovery service is and how rapidly you want to respond to changes.