Runs PHP scripts and one-liners via ddev in ProcessWire projects, bootstraps the PW API for CLI usage, debugs with TracyDebugger, creates Tracy console snippets, and executes direct database queries. Use when running PHP through ddev, writing ProcessWire CLI scripts, building Tracy debugger snippets, or querying the database in a ddev environment.
All PHP CLI commands must run through ddev to use the web container's PHP interpreter.
ddev php script.php # Run PHP script
ddev php --version # Check PHP version
ddev exec php script.php # Execute in web container
ddev ssh # Interactive shell
Include ./index.php from project root to get the full PW API ($pages, $page, $config, $sanitizer, etc.).
All CLI script files must be placed in ./cli_scripts/.
# Inline one-liner (functions API — no $ escaping needed)
ddev php -r "namespace ProcessWire; include('./index.php'); echo PHP_EOL.'Count: '.pages()->count('template=product');"
# With PW API variables — must escape $ as \$
ddev php -r "namespace ProcessWire; include('./index.php'); echo \$pages->count('template=product');"
# Local variables also need escaping
ddev php -r "namespace ProcessWire; include('./index.php'); foreach(templates() as \$t) echo \$t->name.PHP_EOL;"
# Script file
ddev php cli_scripts/myscript.php
One-liner rules:
ddev php -r, not ddev exec php -r (exec adds an extra shell layer that can consume backslash escapes)pages(), templates(), modules()) to avoid bash $ variable expansion$variables, escape them as \$varPHP_EOL to separate from RockMigrations log noised(), browser snippets with bd()database() PDO wrapper, prepared statementsSearch for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer