DDEV containers integration
You can now use Blackfire in your DDEV-local PHP containers.
Blackfire integrates with DDEV-Local. Profiling your PHP applications in DDEV-local containers has never been easier.
DDEV-Local development tools simplifies the life of developers and facilitates the use of containers to run your PHP applications.
While DDEV-Live is ceasing operations, DDEV-Local continues and we are glad to offer an integration with such a great tool.
The best is to run DDEV-Local in a version equivalent or greater than v1.17. Their documentation offers detailed procedures for most OSes.
Configuring it
The Blackfire probe is installed by default and the agent is added as an additional service. All you have to do is to configure it:
ddev config global --web-environment="BLACKFIRE_SERVER_ID=<your_server_id>,BLACKFIRE_SERVER_TOKEN=<your_server_token>,BLACKFIRE_CLIENT_ID=<your_client_id>,BLACKFIRE_CLIENT_TOKEN=<your_client_token>"
That’s it. Isn’t it great when only one configuration command is enough to set everything up?
Profiling from the container
Restart DDEV with ddev restart
and activate Blackfire by running ddev blackfire on
.
You may want to run ddev blackfire off
to disable, ddev blackfire status
to check the status.
You can now profile requests as you are already doing, using the browser extension, the PHP SDK, or the Blackfire CLI running commands such as:
ddev exec blackfire curl https://my.ddev.site
ddev exec blackfire drush st
Give it a try
Whether you are already a DDEV-Local user or simply looking for ways to ease your development process, why don’t you give it a try? Drop us a line to share your experience with us as we are always looking for ways to seamlessly integrate Blackfire with your workflows.
References:
- https://blackfire.io/docs/integrations/paas/ddev
- https://ddev.readthedocs.io/en/latest/users/blackfire-profiling/
Happy profiling!