> ## Content Index
> Fetch the complete content index at: https://michaelbrooks.co.uk/llms.txt
> Use this file to discover other available public pages before exploring further.

# Easy PHP (Laravel, Symfony) Development with Docker using DDEV
- URL: https://michaelbrooks.co.uk/easy-php-laravel-symfony-development-with-docker-using-ddev/
- Published: 2024-10-10T07:19:35.000Z
- Updated: 2024-10-10T07:19:35.000Z
- Author: Michael Brooks
- Tags: DDev, docker, laravel, php, symfony, tutorial, #wordpress

DDEV is an open source tool that makes it simple to get local PHP development environments up and running in minutes. Extend and share per-project environment configurations.

Contents

## Installing DDEV

Windows using [Chocolatey](https://chocolatey.org/?ref=michaelbrooks.co.uk):

```powershell
choco install ddev
```

Mac/Linux using Brew

```bash
brew tap drud/ddev && brew install ddev
```

Mac/Linux install script

```bash
curl -L https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh | bash
```

## Using DDEV in your project

Inside your PHP project’s root directory, run `ddev config` to setup the configuration of DDEV. Once complete, you can type `ddev start` to run the containers inside of Docker. Initial setup and pulling of containers will take a minute or two, but once the containers are downloaded, starting and stopping DDEV will be a cinch.

Once complete, DDEV will give you two URLs, **[http://project.ddev.site](http://project.ddev.site/?ref=michaelbrooks.co.uk)** and **[http://127.0.0.1:32769](http://127.0.0.1:32769/?ref=michaelbrooks.co.uk)** to use for local development. If you wanted to share your project, you need to install ngrok and then you can run `ddev share`.

For more information on using [DDEV’s CLI click here](https://ddev.readthedocs.io/en/stable/users/cli-usage/?ref=michaelbrooks.co.uk).

## Extending DDEV

For a basic installation, that’s it, you’re all finished. However, if you need to extend DDEV, you have complete freedom. For instance, you can go to **/.ddev/config.yaml** and change or add configuration parameters. Here’s my config file as an example…

```yaml
APIVersion: v1.13.1name: blogtype: phpdocroot: publicphp_version: "7.4"webserver_type: nginx-fpmrouter_http_port: "80"router_https_port: "443"xdebug_enabled: trueadditional_hostnames: []additional_fqdns: []nfs_mount_enabled: falseprovider: defaultuse_dns_when_possible: truetimezone: ""
```

You can also add your own custom commands. For instance, if you have a Laravel project you can create a file called **artisan** inside the **/.ddev/commands/web** directory. Within this file add the following

```bash
#!/bin/bashphp artisan $@
```

This will allow you to run any artisan command such as `ddev artisan make:migration create_comments_table`and it will generate a new migration file.

For testing, I added a file named **phpunit** with

```bash
#!/bin/bash./vendor/bin/phpunit
```

This allows me to run `ddev phpunit` and it will run my testing suite. The same can be done for Symfony’s console command. Create a file called **console** inside the same web directory as before and add the following.

```bash
#!/bin/bashphp bin/console $@
```

And now you can run any Symfony console command using `ddev console debug:router` etc. If you would like to read more on this, then please take a look at their [custom commands documentation](https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/?ref=michaelbrooks.co.uk).

## Closing thoughts

I’ve covered the basics of using DDEV, but there is a lot more that it can do. You can switch from nginx to apache, change PHP versions and even add services such as Memcached, Solr, Beanstalk and more.

I’ll make another blog post in the future which goes into more details about these other services, but in the meantime you can sign up to my newsletter using the form below.