mortenscheel / docker-laravel
Docker helper for Laravel projects
Installs: 86
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Type:project
pkg:composer/mortenscheel/docker-laravel
Requires
- php: ^8.4
- laravel-zero/phar-updater: ^1.3
- sebastian/diff: ^5.0.3
Requires (Dev)
- ergebnis/composer-normalize: ^2.31
- larastan/larastan: ^2.11
- laravel-zero/framework: ^11.36
- laravel/pint: ^1.10.3
- nunomaduro/termwind: ^2.3
- phpro/grumphp: ^2.12
- symfony/yaml: ^6.3
- yieldstudio/grumphp-laravel-pint: ^1.0
This package is auto-updated.
Last update: 2025-09-29 12:07:36 UTC
README
A CLI tool to initialize and manage a Docker environment for a Laravel project.
Why?
I liked the simplicity of Laravel Sail, but wanted to have an actual web-server, in stead of just artisan serve.
How?
In stead of a simple bash script like sail, I built this as a Laravel Zero app in order to take advantage of the functionality from Symfony Commands and Processes.
The first argument provided to docker-laravel is used to determine where to send the command (most commands are sent to the app container, but compose commands like up, build and pull are run on the host).
Installation
composer global require mortenscheel/docker-laravel
Or download builds/docker-laravel and place in PATH.
Usage
I recommend creating an alias to make everyday use simpler.
alias d="~/.composer/vendor/bin/docker-laravel"
Initialize project
d init --help
Description:
Initialize Docker environment
Usage:
init [options]
Options:
--slug[=SLUG] Slug used for container prefix
--php[=PHP] PHP-FPM version [default: "8.2"]
--node[=NODE] NodeJS version [default: "20"]
--redis Include Redis service
--meilisearch Include Meilisearch service
--selenium Include Selenium service
--update Update existing environment
This will copy the /docker folder and /docker-compose.yml to your project
It will also update your .env (after you've approved the changes)
Proxied commands
When you run the command inside an initialized Laravel project, docker-laravel will automatically proxy the commands. Examples
d up -d # runs docker compose up -d. All compose commands are supported d composer require foo/bar # Commands starting with composer are sent to composer in the app container d artisan route:list # Sent to artisan in the app container d a route:list # a is aliased to artisan d route:list # if the first param includes a colon, it's interpreted as an artisan command d debug some:command # Runs some:command in Artisan with xdebug enabled d xdebug on/off/status # Controls xdebug in the app container d shell/zsh/bash # Enter the app container as the non-root (laravel) user d root-shell # Enter app as root
Note: this documentation is a work in progress. To see all the available subcommands and features, take a look at DefaultCommand