Skip to content

Commands

Environment setup commands

dx-install

Creates a new environment.

dx-clone-project

Clones an existing project.

dx list

Provides a list of all of your environments, together with their status, directory location, and base URL.

Environment management commands

The following commands should be run from inside a project directory, e.g. cd ~/projects/project-name

dx start

Starts an environment. Please remember that each environment consumes memory and system resources whilst it is started. Ideally, you should only keep one environment started at any one time.

dx stop

Stops an environment.

dx restart

Cycles through the stop and start events.

dx delete

This removes an environment from the underlying Docker layer. However, it does not remove any of your project files. By default a backup of the database is done as part of this process. If you do not want a database snapshot, use the command dx delete --omit-snapshot instead.

Unless you delete the project's files, you can re-use a project that has been deleted by simply running dx start from within the project's directory.

dx describe

Executing this command within a project directory outputs the URLs for the various services and companion applications that are available.

dx magento

This command enables you to call bin/magento. For example, running dx magento cache:flush is equivalent to bin/magento cache:flush. The command is only available for Magento 2 environments.

dx exec

This command allows you to execute anything arbitrarily inside your environment. For example, dx exec ls -alh.

dx composer

This command gives you access to Composer within your environment.

n98-magerun2

The n98-magerun2 tool is installed within each Magento 2 environment. You can access it using the following command, dx exec magerun2.

dx mysql

This command gives you access to the MySQL client within your environment.

dx php

This command gives you access to the PHP CLI within your environment.

dx yarn

This is a compound command that allows you to access a varity of Javascript functionality. When working with a project that has a packages.json file for the first time, running dx yarn causes the installation of all the necessary Javascript packages and dependencies.

Once that has been done you can, for example with a Magento 2 project, use commands like:

    dx yarn grunt clean
    dx yarn grunt exec
    dx yarn grunt less
    dx yarn grunt watch

dx xdebug

You can enable Xdebug within an environment with dx xdebug on, and disable it with dx xdebug off. We currently support Visual Studio Code and PHPStorm.

dx ssh

This creates an isolated SSH session for your environment. You can now run commands directly in that environment. This allows you, for example, to run commands like bin/magento cache:flush rather than needing to do dx magento cache:flush.

Configuration management tasks

Changing your PHP version

If you need to change the PHP version within an environment, use:

    dx config --php-version=8.2
    dx restart