Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 1.32 KB

cli.md

File metadata and controls

41 lines (26 loc) · 1.32 KB

Running CLI Commands

You can run any command on the web server container using the composer server exec command. You need to prepend the command with the options delimiter --.

For example to run a composer installed binary like phpcs run:

composer server exec -- vendor/bin/phpcs

Or to show all environment variables:

composer server exec -- printenv

WP CLI

Local Server provides special support for WP CLI commands via the composer server cli -- command. Prepend all your commends with composer server cli -- and drop the proceeding wp. For example, to list all posts:

composer server cli -- post list

To install a new language file and activate it:

composer server cli -- language core install fr_FR

CLI commands via Local Server also support piping for more complex shell commands.

Importing a database backup

To import a database backup with local server, you will need to have a database backup file in a location that is accessible from the project root.

composer server cli -- db import database.sql

Note: For privacy reasons any database backups that are version controlled should have any personally identifiable information removed and extra care should be taken to avoid committing database backup files containing personal data.