LinuxCommandLibrary

ddev

Create and manage local development environments

TLDR

Start up a project

$ ddev start
copy

Configure a project's type and docroot
$ ddev config
copy

Follow the log trail
$ ddev logs [[-f|--follow]]
copy

Run composer within the container
$ ddev composer
copy

Install a specific Node.js version
$ ddev nvm install [version]
copy

Export a database
$ ddev export-db [[-f|--file]] [/tmp/db.sql.gz]
copy

Run a specific command within a container
$ ddev exec [echo 1]
copy

SYNOPSIS

ddev [command] [options]

PARAMETERS

start
    Starts the ddev environment for the current project.

stop
    Stops the ddev environment for the current project.

restart
    Restarts the ddev environment for the current project.

describe
    Provides details about the ddev environment.

list
    Lists all running ddev projects.

config
    Configures the ddev project settings, either interactively or with options.

ssh
    Opens an SSH connection to the web container.

exec
    Executes a command in the web container.

import-db
    Imports a database dump into the project's database.

export-db
    Exports the project's database to a file.

remove
    Removes the ddev environment for the current project.

version
    Displays the ddev version information.

DESCRIPTION

ddev is a powerful, open-source tool that makes it easy to create and manage local PHP development environments. It uses Docker under the hood to provide isolated, consistent environments for your projects, regardless of the underlying operating system. This eliminates the "works on my machine" problem and streamlines the development workflow.

ddev supports many popular PHP frameworks and CMSs like Drupal, WordPress, Laravel, and Symfony, as well as other technologies like Node.js, Python, and databases (MySQL, MariaDB, PostgreSQL). You can easily configure your environment with custom Dockerfiles and configuration files, enabling you to precisely match your production environment.

ddev automates common tasks like setting up databases, configuring web servers, and managing dependencies. By using ddev, developers can focus on writing code and testing their applications, instead of spending time configuring and maintaining development environments. It is designed to be simple to use, yet flexible enough to handle complex projects.

CAVEATS

ddev requires Docker to be installed and running. It's crucial to ensure that Docker resources (memory, CPU) are sufficient for the project's needs.

CONFIGURATION FILES

The primary configuration file is `.ddev/config.yaml`. This file defines the project settings such as the project name, document root, database type, PHP version, and more. Developers can customize this file to tailor the environment to their specific needs.

EXTENDING DDEV

ddev provides a flexible plugin system that allows developers to extend its functionality. You can create custom commands, services, and configurations to integrate with other tools and workflows.

HISTORY

ddev was created to simplify local PHP development using Docker. It evolved from earlier tools and scripts, aiming to provide a standardized and user-friendly experience for developers working on various PHP projects. It addresses the common pain points of environment inconsistencies and complex configurations, allowing a developer to focus on the application.

SEE ALSO

Copied to clipboard