vinnylinux
vinnylinux

Reputation: 7034

Custom global configuration values in Symfony 2

I'm aware of using custom configuration values for my custom services, but what if I have global configuration values that I wish to use everywhere? A define would save my ass, but I'm sure the DI container has a more elegant approach.

I need a few global keys, so, how do define them in Symfony 2?

Upvotes: 0

Views: 1099

Answers (2)

Lusitanian
Lusitanian

Reputation: 11132

Define them in parameters.ini, and then you can do $container->getParameter('blah');

Upvotes: 1

greg0ire
greg0ire

Reputation: 23265

I think you are looking for the container. This page shows how to define services, but you can do the same with parameters.

Upvotes: 0

Related Questions