|
| 1 | +--- |
| 2 | +nav: |
| 3 | + title: Development Environment |
| 4 | + position: 3 |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +# Development Environment |
| 9 | + |
| 10 | +Shopware CLI provides a fully integrated Docker-based development environment. A single command launches your entire stack, streams logs, manages watchers, and lets you configure PHP and profiling - all without manually editing Docker files. |
| 11 | + |
| 12 | +:::info |
| 13 | +The development environment requires a compatibility date of `2026-03-01` or later in your `.shopware-project.yml`. Projects created with `shopware-cli project create` have this set automatically. |
| 14 | +::: |
| 15 | + |
| 16 | +## Starting the environment |
| 17 | + |
| 18 | +From your Shopware project root, run: |
| 19 | + |
| 20 | +```bash |
| 21 | +shopware-cli project dev |
| 22 | +``` |
| 23 | + |
| 24 | +This launches the development terminal user interface (TUI). If your containers aren't running yet, the dashboard starts them. If Shopware hasn't been installed, it guides you through the installation wizard. |
| 25 | + |
| 26 | +To start without the interactive dashboard (for CI or scripting): |
| 27 | + |
| 28 | +```bash |
| 29 | +shopware-cli project dev start |
| 30 | +``` |
| 31 | + |
| 32 | +To check whether the environment is running: |
| 33 | + |
| 34 | +```bash |
| 35 | +shopware-cli project dev status |
| 36 | +``` |
| 37 | + |
| 38 | +To stop everything: |
| 39 | + |
| 40 | +```bash |
| 41 | +shopware-cli project dev stop |
| 42 | +``` |
| 43 | + |
| 44 | +## Development terminal user interface (TUI) |
| 45 | + |
| 46 | +The dashboard has three tabs, which can be switched to with the corresponding number key or by using the Tab button. |
| 47 | + |
| 48 | +### 1. Overview Tab |
| 49 | + |
| 50 | +Your environment at a glance: |
| 51 | + |
| 52 | +**Left panel:** |
| 53 | + |
| 54 | +- **Shop** - Shopware version, environment type (`docker`, `local`, or `symfony-cli`), shop and admin URLs, and security update expiry date |
| 55 | +- **Access** - URLs, usernames, and passwords for Shop Admin, Adminer, and Mailpit |
| 56 | +- **Setup health** - runtime checks (PHP version, memory limit), local behavior warnings, and debug settings, each showing the current value against the recommended one |
| 57 | + |
| 58 | +**Right panel:** |
| 59 | + |
| 60 | +- **Watchers** - toggle Admin and Storefront watchers on or off |
| 61 | + |
| 62 | +### 2. Instance Tab |
| 63 | + |
| 64 | +Browse and stream logs from your running environment: |
| 65 | + |
| 66 | +- **Containers** - all Docker containers with a live status indicator for the active one |
| 67 | +- **Processes** - watcher processes (Admin Watcher, Storefront Watcher) when running |
| 68 | +- **Log files** - application log files (e.g., `dev.log`) |
| 69 | + |
| 70 | +Use the sidebar to switch sources. Toggle follow mode with `Enter`. |
| 71 | + |
| 72 | +### 3. Config Tab |
| 73 | + |
| 74 | +The following table lists the settings you can change in the Config tab: |
| 75 | +| Setting | Options | |
| 76 | +|---------|---------| |
| 77 | +| **PHP Version** | `8.2`, `8.3`, `8.4`, `8.5` | |
| 78 | +| **Profiler** | `none`, `xdebug`, `blackfire`, `tideways`, `pcov`, `spx` | |
| 79 | + |
| 80 | +When selecting `blackfire` or `tideways`, additional credential fields appear. Sensitive credentials are stored in `.shopware-project.local.yml` (excluded from version control). |
| 81 | + |
| 82 | +:::info |
| 83 | +The profiler is now configured via the Config tab. |
| 84 | +::: |
| 85 | + |
| 86 | +After changing settings, select **Save & Regenerate** to update `compose.yaml`. Restart the environment for changes to take effect. |
| 87 | + |
| 88 | +## Migrating from legacy setups |
| 89 | + |
| 90 | +If your project was created before March 2026 and uses the older `make up`/`make setup` workflow with a hand-written `compose.yaml`, running `shopware-cli project dev` automatically detects this and launches a setup wizard instead of the dashboard. |
| 91 | + |
| 92 | +### What triggers the wizard |
| 93 | + |
| 94 | +The wizard appears when your project's `compatibility_date` in `.shopware-project.yml` is before `2026-03-01` (or missing entirely). This signals that the project hasn't been configured for the new development environment yet. |
| 95 | + |
| 96 | +### What the wizard does |
| 97 | + |
| 98 | +Walking through the setup wizard takes about a minute. Here's what happens at each step: |
| 99 | + |
| 100 | +1. **Welcome** - explains what the wizard will do and asks you to proceed |
| 101 | +2. **Admin user** - pre-fills `admin` (you can change it) for the Shopware admin account |
| 102 | +3. **Admin password** - pre-fills `shopware` (you can change it); stored as credentials in `.shopware-project.yml` |
| 103 | +4. **PHP version** - reads your `composer.lock` to determine compatible PHP versions and offers the highest supported one as the default (e.g., `8.5`) |
| 104 | + |
| 105 | +After you confirm, the wizard: |
| 106 | + |
| 107 | +- Sets `compatibility_date` to `2026-03-01` in `.shopware-project.yml` |
| 108 | +- Adds a `local` environment with type `docker` and your chosen URL/credentials |
| 109 | +- Configures the Docker PHP version |
| 110 | +- Generates a new `compose.yaml` tailored to your project's dependencies |
| 111 | +- Starts the Docker containers and runs the Shopware installer |
| 112 | + |
| 113 | +### What happens to existing files |
| 114 | + |
| 115 | +| File | What changes | |
| 116 | +|------|-------------| |
| 117 | +| `.shopware-project.yml` | Updated with `compatibility_date`, `environments`, and `docker` config | |
| 118 | +| `.shopware-project.local.yml` | Created if you chose a profiler with credentials (Blackfire, Tideways) | |
| 119 | +| `compose.yaml` | **Replaced** with the CLI-managed version - your old file is overwritten, so back it up first and move any customizations to `compose.override.yaml` | |
| 120 | +| `Makefile` | **Not touched** - you can delete it once you've migrated, or keep it around | |
| 121 | +| `composer.json` | If `shopware/deployment-helper` isn't already present, it's added to `require` | |
| 122 | + |
| 123 | +### After the wizard completes |
| 124 | + |
| 125 | +If `shopware/deployment-helper` was added to `composer.json`, you'll be prompted to run: |
| 126 | + |
| 127 | +```bash |
| 128 | +composer install |
| 129 | +``` |
| 130 | + |
| 131 | +This pulls in the helper package, which the dashboard uses to run the Shopware installer. After that, the environment starts automatically. |
| 132 | + |
| 133 | +Once migrated, the legacy `make up`/`make down`/`make setup` workflow is no longer needed; use `shopware-cli project dev` to manage your environment instead. If you had customizations in your old `compose.yaml`, move them to `compose.override.yaml` before running the wizard (or recover them from git afterwards). |
| 134 | + |
| 135 | +## Viewing application logs |
| 136 | + |
| 137 | +Inspect Shopware logs without opening the dashboard: |
| 138 | + |
| 139 | +```bash |
| 140 | +# Last 100 lines of the most recently modified log |
| 141 | +shopware-cli project logs |
| 142 | + |
| 143 | +# A specific log file |
| 144 | +shopware-cli project logs dev-2026-05-18.log |
| 145 | + |
| 146 | +# Follow the log (like tail -f) |
| 147 | +shopware-cli project logs -f |
| 148 | + |
| 149 | +# List available log files |
| 150 | +shopware-cli project logs -l |
| 151 | + |
| 152 | +# Set number of lines |
| 153 | +shopware-cli project logs --lines 50 |
| 154 | +``` |
| 155 | + |
| 156 | +## Running Shopware commands |
| 157 | + |
| 158 | +Use `shopware-cli project console` to run `bin/console` commands from your host - no need to shell into the container: |
| 159 | + |
| 160 | +```bash |
| 161 | +shopware-cli project console cache:clear |
| 162 | +shopware-cli project console plugin:refresh |
| 163 | +shopware-cli project console dal:refresh:index |
| 164 | +``` |
| 165 | + |
| 166 | +When using the Docker executor, commands automatically run inside the web container via `docker compose exec`. |
| 167 | + |
| 168 | +To type a little less, you can also use the `swx` alias as a shortcut for `shopware-cli project console`: |
| 169 | + |
| 170 | +```bash |
| 171 | +swx cache:clear |
| 172 | +swx plugin:refresh |
| 173 | +swx dal:refresh:index |
| 174 | +``` |
| 175 | + |
| 176 | +## Docker services |
| 177 | + |
| 178 | +The CLI generates a `compose.yaml` tailored to your project: |
| 179 | + |
| 180 | +| Service | Description | URL | |
| 181 | +|---------|-------------|-----| |
| 182 | +| **web** | PHP + Node.js with Caddy | `http://127.0.0.1:8000` | |
| 183 | +| **database** | MariaDB 11.8 | internal | |
| 184 | +| **adminer** | Database management UI | `http://127.0.0.1:9080` | |
| 185 | +| **mailer** | Mailpit (email testing) | `http://127.0.0.1:8025` | |
| 186 | +| **lavinmq** | Message queue * | `http://127.0.0.1:15672` | |
| 187 | +| **opensearch** | Search engine * | `http://127.0.0.1:9200` | |
| 188 | +| **blackfire** | Blackfire agent * | internal | |
| 189 | +| **tideways-daemon** | Tideways agent * | internal | |
| 190 | + |
| 191 | +\* *Auto-detected from `composer.lock` or enabled via configuration.* |
| 192 | + |
| 193 | +::: warning |
| 194 | +The `compose.yaml` file is fully managed by the Shopware CLI and regenerated whenever you change configuration. **Never edit it directly.** |
| 195 | +::: |
| 196 | + |
| 197 | +### Customizing with `compose.override.yaml` |
| 198 | + |
| 199 | +Place all customizations in `compose.override.yaml`. Docker Compose [merges multiple files](https://docs.docker.com/compose/how-tos/multiple-compose-files/merge/), so your overrides are applied on top of the managed file: |
| 200 | + |
| 201 | +```yaml |
| 202 | +# compose.override.yaml |
| 203 | +services: |
| 204 | + web: |
| 205 | + environment: |
| 206 | + APP_ENV: dev |
| 207 | + COMPOSER_HOME: /tmp/composer |
| 208 | + ports: |
| 209 | + - "9003:9003" # Xdebug |
| 210 | + |
| 211 | + # Add your own services |
| 212 | + redis: |
| 213 | + image: redis:7-alpine |
| 214 | + ports: |
| 215 | + - "6379:6379" |
| 216 | +``` |
| 217 | +
|
| 218 | +The CLI-generated `compose.yaml` includes this header for clarity: |
| 219 | + |
| 220 | +```yaml |
| 221 | +# This file is managed by shopware-cli. Do not edit manually. |
| 222 | +# Create a compose.override.yaml to customize services. |
| 223 | +``` |
| 224 | + |
| 225 | +### Auto-Detection |
| 226 | + |
| 227 | +The compose file inspects your `composer.lock` at generation time: |
| 228 | + |
| 229 | +- `symfony/amqp-messenger` - adds **LavinMQ** and sets `MESSENGER_TRANSPORT_DSN` |
| 230 | +- `shopware/elasticsearch` - adds **OpenSearch** with environment variables |
| 231 | +- PHP version defaults to `8.3`, overridable in the Config tab |
| 232 | + |
| 233 | +## Environment executors |
| 234 | + |
| 235 | +The CLI abstracts command execution across environment types, configured per environment in `.shopware-project.yml`: |
| 236 | + |
| 237 | +| Type | Behavior | |
| 238 | +|------|----------| |
| 239 | +| `docker` | Executes commands inside the web container via `docker compose exec` | |
| 240 | +| `local` | Executes commands directly on the host | |
| 241 | +| `symfony-cli` | Uses the Symfony CLI binary (auto-detected) | |
| 242 | + |
| 243 | +```yaml |
| 244 | +environments: |
| 245 | + local: |
| 246 | + type: docker |
| 247 | + url: http://127.0.0.1:8000 |
| 248 | + admin_api: |
| 249 | + username: admin |
| 250 | + password: shopware |
| 251 | +``` |
| 252 | + |
| 253 | +## Ports |
| 254 | + |
| 255 | +The web container exposes these ports by default: |
| 256 | + |
| 257 | +| Port | Purpose | |
| 258 | +|------|---------| |
| 259 | +| `8000` | Storefront | |
| 260 | +| `8080` | HTTP (alternative) | |
| 261 | +| `5173` | Admin Watcher (Vite) | |
| 262 | +| `9998` | Storefront Watcher | |
| 263 | +| `9999` | Storefront Proxy | |
| 264 | +| `5773` | IDE debugging | |
| 265 | + |
| 266 | +## Configuration reference |
| 267 | + |
| 268 | +### `.shopware-project.yml` |
| 269 | + |
| 270 | +```yaml |
| 271 | +compatibility_date: '2026-03-01' |
| 272 | +
|
| 273 | +url: http://127.0.0.1:8000 |
| 274 | +
|
| 275 | +docker: |
| 276 | + php: |
| 277 | + version: "8.3" # 8.2, 8.3, 8.4, 8.5 |
| 278 | + profiler: xdebug # none (empty), xdebug, blackfire, tideways, pcov, spx |
| 279 | + blackfire_server_id: "" # required when profiler is blackfire |
| 280 | + blackfire_server_token: "" # required when profiler is blackfire |
| 281 | + tideways_api_key: "" # required when profiler is tideways |
| 282 | +
|
| 283 | +environments: |
| 284 | + local: |
| 285 | + type: docker |
| 286 | + url: http://127.0.0.1:8000 |
| 287 | + admin_api: |
| 288 | + username: admin |
| 289 | + password: shopware |
| 290 | +``` |
| 291 | + |
| 292 | +### `.shopware-project.local.yml` |
| 293 | + |
| 294 | +Sensitive credentials are stored in `.shopware-project.local.yml` (add to `.gitignore`): |
| 295 | + |
| 296 | +```yaml |
| 297 | +docker: |
| 298 | + php: |
| 299 | + blackfire_server_id: "your-server-id" |
| 300 | + blackfire_server_token: "your-server-token" |
| 301 | +``` |
| 302 | + |
| 303 | +## Troubleshooting |
| 304 | + |
| 305 | +### `compose.yaml` keeps getting reset |
| 306 | + |
| 307 | +This is by design. `compose.yaml` is fully managed and regenerated on config changes. Use `compose.override.yaml` for all customizations. See [Customizing with compose.override.yaml](#customizing-with-composeoverrideyaml). |
| 308 | + |
| 309 | +### Containers won't start |
| 310 | + |
| 311 | +Check logs with `shopware-cli project logs -f` or from the Instance tab in the TUI. |
| 312 | + |
| 313 | +### Shopware isn't installed |
| 314 | + |
| 315 | +The development TUI's initialization wizard, which mirrors steps in Shopware's in-browser First Run Wizard, prompts you to run the installer. It uses `shopware/deployment-helper` to install Shopware with your chosen locale, currency, and Admin credentials. |
| 316 | + |
| 317 | +### Compatibility date error |
| 318 | + |
| 319 | +Set `compatibility_date: '2026-03-01'` in `.shopware-project.yml`. For more context, see the [build command docs](../../products/tools/cli/project-commands/build.md#compatibility-date). |
| 320 | + |
| 321 | +## Next steps |
| 322 | + |
| 323 | +- [Start Developing](./start-developing.md) - What to do once your environment is running |
| 324 | +- [Build Extensions](./extensions/index.md) - Create plugins, apps, and themes |
| 325 | +- [Using Watchers](./tooling/using-watchers.md) - Hot Module Replacement for Admin and Storefront |
0 commit comments