serversideup/spin/spin-laravel-development
- community
Checking that the SKILL.md file is still in the repository.
Develops, tests, and deploys Laravel applications using Spin and serversideup/php Docker images. Covers Docker Compose configuration, development environment setup, container commands, running Laravel tests (PHPUnit and Pest), SPIN_ENV selection and CI parity, parallel Compose environments, Laravel service configuration (databases, queues, Horizon, Reverb), server provisioning, and deployment workflows. Use when working with Spin, Docker Compose files, serversideup/php images, spin commands, running artisan test, configuring Laravel services in Docker, or deploying Laravel apps to production servers.
Install
npx vskill@latest install serversideup/spin/spin-laravel-developmentSKILL.md
Spin Laravel Development
Table of contents
- Safety guardrails
- Laravel Boost MCP
- How Spin works
- Project structure
- Dockerfile pattern
- Development workflow
- Running tests
- serversideup/php images
- Laravel services
- Deployment
- Server provisioning
- Common pitfalls
- Reference files
Safety guardrails
- NEVER run commands that could destroy data without explicitly confirming with the user first. This includes
docker system prune,docker volume rm, dropping databases, removing services, or any destructive operation. - Avoid
spin kill— it kills all containers on the machine (not just this project) and requires interactive confirmation, which hangs in non-interactive contexts. Usespin stoporspin downfor the project's stack. - If Spin fails to run, it is likely because Docker Desktop is not started. Check with
docker info. If Docker is not running, tell the user to start Docker Desktop and offer to retry before continuing. - Use
spin exec(running stack) orspin run(stopped stack), with-Tin AI/CI/subprocess contexts — see Running commands. - Projects start from templates but are free to restructure. Treat the project's own compose files, Dockerfile, and
.envas the source of truth for service names, versions, ports, and paths — the examples in this skill show typical template defaults, not guarantees.
Laravel Boost MCP
Spin runs PHP inside Docker, not on the host machine. Laravel Boost's MCP server needs a bridge script (spin-mcp-wait.sh) that retries until Docker is ready and filters Docker's stdout noise to preserve the JSON-RPC stdio protocol.
The required .env configuration:
NEVER use `spin-mcp-wait.sh` to run commands. It is exclusively for MCP server startup. The script will refuse non-MCP invocations with this error:
If that error appears, drop spin-mcp-wait.sh and invoke spin directly:
How Spin works
Spin wraps Docker Compose and follows its syntax exactly. The compose-wrapping commands (up, down, stop, build, logs, ps, pull, run, exec) forward any additional flags straight to the wrapped docker compose subcommand, so every official Docker Compose option works (see COMMANDS.md for per-command exceptions).
The core pattern is Docker Compose overrides: a base docker-compose.yml is merged with an environment-specific override file. Spin sets COMPOSE_FILE=docker-compose.yml:docker-compose.$SPIN_ENV.yml automatically.
`SPIN_ENV` defaults to `dev`, so spin up is equivalent to:
Override with SPIN_ENV=testing spin up to use docker-compose.testing.yml instead.
The base file defines shared service structure. Override files add environment-specific settings. Docker merges them intelligently — override values replace or extend base values. (Image versions and service names below are illustrative — mirror the project's actual files.)
Project structure
Typical layout from the Laravel templates (individual projects may differ):
The .infrastructure/ folder is flexible. conf/ stores committed configuration. volume_data/ stores gitignored persistent data for any service. This keeps everything portable — moving the project folder moves all data with it. Check the project's .gitignore to determine what is tracked.
Dockerfile pattern
Multi-stage build using serversideup/php (match the PHP version and variant to the project):
Stages: base (production image), development (matches host UID/GID via SPIN_USER_ID/SPIN_GROUP_ID), ci (root for CI pipelines), deploy (copies app code, sets permissions). The dev compose file targets the development stage via build.target.
Development workflow
This is where 90% of Spin usage happens.
Starting the environment
spin up runs in the foreground — open a second terminal for other commands. Press Ctrl+C to stop.
Running commands
Syntax: spin <exec|run> [-T] <service> <command> — the service argument is the service name from the project's docker-compose.yml (verify there; not every project names its services php and node).
`exec` vs `run`:
- `spin exec` reuses the live container from an already-running stack. Near-instant. Default for
artisan,composer,npm, and ad-hoc commands during development. - `spin run` creates a new container each invocation. Use when the stack is not running, or when isolated state / different env vars are needed.
The `-T` flag: Compose auto-detects TTY, so interactive terminal usage works without -T. Add -T as a defensive default when invoking from an AI agent, CI pipeline, or wrapper script — auto-detection can misfire in those contexts, causing hangs or ANSI-garbled output:
Volume mounting
In development, the project directory is mounted at .:/var/www/html/, so code changes are reflected instantly — no rebuild needed for code changes.
When to rebuild
Use spin up --build when:
- Starting a development environment (recommended as default habit)
- After Dockerfile changes (adding PHP extensions, changing base image)
- After modifying build-related compose settings
Code-only changes never need a rebuild — volume mounts handle it.
.env dual-use
The .env file is read by both Docker Compose (for variable substitution like ${SPIN_APP_DOMAIN}) and Laravel inside the container (since the project is volume-mounted). Example:
Which compose file to edit
| Change type | File | |
|---|---|---|
| Shared service definitions (image, depends_on) | docker-compose.yml | |
| Dev-only (ports, volume mounts, build target, Traefik labels) | docker-compose.dev.yml | |
| Prod-only (deploy config, Swarm labels, named volumes, TLS) | docker-compose.prod.yml |
Essential commands
| Command | What it does | |
|---|---|---|
spin up | Start all services (docker compose up) | |
spin up --build | Start and rebuild | |
spin stop | Stop containers without removing them | |
spin down | Stop and remove containers | |
spin run <svc> <cmd> | One-off command in new container | |
spin exec <svc> <cmd> | Command in running container | |
spin logs | View container logs | |
spin ps | List running containers | |
spin build | Build images without starting |
See COMMANDS.md for the complete command reference.
Running tests
Prefer the already-running dev stack — it's faster than spinning up a parallel CI stack:
php artisan test works for both PHPUnit and Pest.
Inspect the project's phpunit.xml before choosing a stack: if tests are self-contained (sqlite :memory:, array/sync drivers), the dev stack is plenty; otherwise it usually still works. Reach for SPIN_ENV=ci only when CI parity is explicitly needed.
See TESTING.md for the stack decision tree, the full CI-parity workflow, parallel Compose environments, and the override-network gotcha.
serversideup/php images
Choose the right variant:
| Variant | Use case | |
|---|---|---|
fpm-nginx | Most Laravel apps (PHP-FPM + NGINX) | |
fpm-apache | Apps needing .htaccess support | |
frankenphp | Laravel Octane with FrankenPHP | |
cli | Artisan commands, queue workers, schedulers |
Tag pattern: serversideup/php:<php-version>-<variant>[-alpine] Example: serversideup/php:8.5-fpm-nginx-alpine
Key environment variables for production:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingresources/boost/skills/spin-laravel-development/SKILL.md
Popularity
- Repository stars
- 1,489
- Repository forks
- 65
- 7-day trend score
- 37
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/serversideup/spin/spin-laravel-development)