1
Go CLI
Virgil edited this page 2026-03-11 12:14:42 +00:00
Go CLI
Module: forge.lthn.ai/core/php
Binary: core-php
Architecture
The Go side provides CLI commands for PHP/Laravel development. Commands are registered via AddPHPCommands(root) (subcommand of core php) or AddPHPRootCommands(root) (standalone core-php binary).
Workspace-aware: when run inside a workspace with workspace.yaml, commands auto-chdir to the active package directory.
Commands
Development
| Command | File | Description |
|---|---|---|
php dev |
cmd_dev.go | Start FrankenPHP + Vite + Horizon + Reverb + Redis with live reload |
php logs |
cmd_dev.go | Tail service logs |
php stop |
cmd_dev.go | Stop all dev services |
php status |
cmd_dev.go | Show service status |
php ssl |
ssl.go | SSL certificate management |
php shell |
cmd_commands.go | Interactive shell |
Build & Deploy
| Command | File | Description |
|---|---|---|
php build |
cmd_build.go | Production build (npm, composer, assets) |
php serve |
cmd_serve_frankenphp.go | FrankenPHP production server (CGO) |
php ci |
cmd_ci.go | CI pipeline execution |
php deploy |
cmd_deploy.go | Deployment operations |
Package Management
| Command | File | Description |
|---|---|---|
php packages |
cmd_packages.go | Package workspace management |
Key Files
| File | Description |
|---|---|
| cmd.go | Command registration, workspace detection, style definitions |
| handler.go | FrankenPHP request handler |
| bridge.go | Go-PHP bridge |
| services.go | Service process management (FrankenPHP, Vite, Horizon, Reverb, Redis) |
| services_unix.go | Unix-specific service code |
| services_windows.go | Windows-specific service code |
| container.go | Docker container management |
| coolify.go | Coolify deployment integration |
| deploy.go | Deployment logic |
| detect.go | Project/framework detection |
| dockerfile.go | Dockerfile generation |
| env.go | Environment variable management |
| extract.go | Archive extraction |
| i18n.go | Internationalisation |
| packages.go | Composer package operations |
| php.go | PHP binary detection and execution |
| quality.go | Code quality (qa.yaml config) |
| ssl.go | SSL certificate generation/management |
| testing.go | Test helpers |
| workspace.go | Workspace config loading |
Service Management
The dev command orchestrates multiple long-running processes:
- FrankenPHP — PHP application server (worker mode).
- Vite — Frontend asset bundler with HMR.
- Horizon — Laravel queue worker.
- Reverb — Laravel WebSocket server.
- Redis — Cache/queue backend.
Each service has styled log output with colour-coded prefixes.
FrankenPHP Integration
When built with CGO enabled (cmd_serve_frankenphp.go), the binary embeds FrankenPHP for serving PHP applications directly from Go. The handler.go file implements the request handler.
Dependencies
Direct: core/cli, go-i18n, go-io.