I don’t use Vagrant (I know, I know) and because of that, my develop machine (my laptop) does not have the same configuration as our server. And while I wanted to use xhprof locally, our server didn’t have it. I also wanted to use the jns/xhprof-bundle.
So I threw the bundle in my composer.json file and decided I’d only load it for the dev
environment and only if xhprof was installed.
1 2 3 4 5 6 |
|
Now, the issue with this is: the jns/xhprof-bundle requires some configuration. You can’t just leave the configuration inside your config.yml, because then Symfony would complain that it doesn’t know why those configuration values are there.
I got the answer on the Symfony IRC channel from jrobeson: use a closure loader. Where you load your configuration file, add the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Note: I know I could have used a different environment, but using this way, if xhprof was installed on the server, I could use it there as well (we have a staging environment on the server that runs the app in dev mode).