Container-Interop support for Prophiler
The Container-Interop project tries to "identify and standardize features in container objects (service locators, dependency injection containers, etc.) to achieve interoperability". This hopefully will lead to a new PSR some day. Being a fan of Prophiler which is a PHP Profiler & Developer Toolbar, I thought it would be cool to display all the calls to the get() and has() methods exposed by the Container Interop project, see the ContainerInterface.
As it turns out it was fairly trival to extend Prophiler which lead to the creation of this Pull Request. Luckily the Pull Request got already merged which means if you are using version 1.5.0 of Prophiler you are able to use the feature in your application. Using the feature is quite simple: Create an instance of the Prophiler as well as an instance of any container implementing container-intertop (e.g. Aura.DI in this case):
$prophiler = new \Fabfuel\Prophiler\Profiler(); $builder = new \Aura\Di\ContainerBuilder(); $container = $builder->newInstance();
Decorrate the $container with the provided \Fabfuel\Prophiler\Adapter\Interop\Container\Container instance:
$container = new \Fabfuel\Prophiler\Adapter\Interop\Container\Container($container, $prophiler);
The decorated container will now start profiling the creation of your objects. The profiling results will be displayed in the Toolbar which comes with Prophiler.
If you want to include Prophiler in your PSR-7 pipeline, read here how to use the prophiler-psr7-middleware package which we built.