# DDEV

[DDEV](https://ddev.com) is a development platform for PHP based on Docker containers ([DDEV-Local](https://ddev.com/ddev-local/)).

## DDEV-Local

You must use version 1.17 or above of DDEV-local. Their [documentation](https://ddev.readthedocs.io/en/stable/#installation)offers detailed procedures for most OSes.

## Configuration

The Blackfire probe is installed by default and the agent is added as an additional service. It can be configured globally with this command:

The credentials can be configured for a specific project by updating its [DDEV config file](https://ddev.readthedocs.io/en/latest/users/configuration/config/)located in `.ddev/config.yaml`:

## Restart DDEV

```bash
ddev restart
```

## Activate Blackfire

To activate Blackfire after every `ddev restart`, run the following command:

```bash
ddev blackfire
```

To activate Blackfire every time your project starts, in the `.ddev/config.yml`file of your DDEV project, define a custom [hook](https://ddev.readthedocs.io/en/stable/users/configuration/hooks/)similar to:

```yaml
# .ddev/config.yml

hooks:
    post-start:
        - exec-host: 'ddev blackfire'
```

Additional commands:

- Disable the Blackfire Probe and stops the Blackfire agent (this can be useful if you need to run xdebug, which is deactivated when you start Blackfire with `ddev blackfire`):

```bash
ddev blackfire off
```

- Verify if Blackfire is currently enabled, as well as the currently installed: Blackfire Probe version.

```bash
ddev blackfire status
```

You can now profile requests with [all available methods](../../profiling-cookbooks/index). When profiling with the CLI, prefix the `blackfire` commands with `ddev exec`:

- `ddev exec blackfire curl https://foobar.ddev.site`
- `ddev exec blackfire drush st`

> **Note**
>
> When using `ddev exec blackfire curl http://127.0.0.1`, there is no need to specify a DDEV external port as you are already executing it in a DDEV context. Additional documentation is provided by [ddev-contrib](https://ddev.readthedocs.io/en/stable/users/debugging-profiling/blackfire-profiling/).

## Blackfire Player

[Blackfire Player](../../builds-cookbooks/player) can be used in your DDEV project to trigger automated performance tests or crawl information.

DDEV support [custom commands](https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/)enriching its standard behavior. Let's setup a `ddev player` command for a project by creating it configuration file `.ddev/commands/host/player` with this content:
