Skip to content

cwp open

shipped 1.0.0
cwp open [env] [flags]

Acts on the local site. Name an environment to act there instead.

ArgumentWhat it isDefault
[env]environment to open (default: the local DDEV site)
FlagWhat it doesDefault
--printwrite the URL to stdout and open nothingoff
--with-agentwith —dry-run on a host with no shell: install and remove the PHP agent so the plan is realoff

Plus the shared flags --json, -v, --verbose, -q, --quiet and --dry-run.

What it does

Opens the site in a browser.

Locally the URL comes from DDEV itself, with the conventional <name>.ddev.site as the fallback while the project is down. Remotely it comes from environments.<env>.url, for any provider, so an ssh environment answers with its own URL. cwp uses open on macOS and xdg-open elsewhere.

A missing opener is not a failure. On a headless machine, over SSH, or on Windows, it prints the URL and exits 0. On Windows cwp ships no opener on purpose, rather than an untested cmd /c start.

--print writes the URL to stdout and opens nothing. It is the scriptable form, and the one place in this command where stdout carries a payload. It does not combine with --json, since both claim stdout: cwp refuses rather than corrupting one of them.

Example

cwp open                          # the local DDEV URL
cwp open prod                     # the environment's configured url
open "$(cwp open prod --print)"   # on a machine cwp has no opener for

What it does not do

It starts nothing. While DDEV is down, cwp open shows you the URL the project will have. ddev start is yours to run.