PHPackages                             dimer47/zero - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. dimer47/zero

ActiveLibrary[CLI &amp; Console](/categories/cli)

dimer47/zero
============

Lightweight Docker wrapper for Laravel Zero CLI applications, inspired by Laravel Sail

v1.0.1(3mo ago)01MITShellPHP ^8.2

Since Jan 22Pushed 3mo agoCompare

[ Source](https://github.com/dimer47/zero)[ Packagist](https://packagist.org/packages/dimer47/zero)[ RSS](/packages/dimer47-zero/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

Zero - Docker CLI Environment for Laravel Zero
==============================================

[](#zero---docker-cli-environment-for-laravel-zero)

 [![Laravel Zero](https://raw.githubusercontent.com/laravel-zero/docs/master/images/logo/laravel-zero-readme.png)](https://raw.githubusercontent.com/laravel-zero/docs/master/images/logo/laravel-zero-readme.png)

 [![Latest Stable Version](https://camo.githubusercontent.com/c1ea17b7038852d599ce8cad355738251d41b9bb7548b8bacd10f1b484360a69/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64696d657234372f7a65726f)](https://packagist.org/packages/dimer47/zero) [![License](https://camo.githubusercontent.com/b01b51f30292360be53776298eff4d4ea249facee05e5fbc75da55d8b9eb69e0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f64696d657234372f7a65726f)](https://packagist.org/packages/dimer47/zero)

A minimal Docker wrapper for Laravel Zero, inspired by Laravel Sail but designed specifically for CLI applications.

✨ Features
----------

[](#-features)

- 🚀 **Ephemeral Containers** - Each command runs in a fresh container, no daemon needed
- 🎯 **Auto-detection** - Automatically detects your application binary from `composer.json`
- 🐘 **Multi PHP Version** - Support for PHP 8.2, 8.3, and 8.4
- 🪶 **Alpine-based** - Ultra-lightweight images (~50MB vs ~1GB)
- 📦 **Ready to use** - One command installation

📋 Requirements
--------------

[](#-requirements)

- Docker Desktop (macOS/Windows) or Docker Engine (Linux)
- Docker Compose v2+
- A Laravel Zero project

🚀 Installation
--------------

[](#-installation)

```
composer require dimer47/zero --dev
```

Publish the Docker configuration:

```
php application zero:install
```

This will:

- Create `docker-compose.yml` - Docker Compose configuration
- Set `PHP_VERSION` in your `.env` file (created if needed)

You can specify a different PHP version:

```
php application zero:install --php=8.4
```

Build the Docker image:

```
./vendor/bin/zero build
```

### 🎯 Shell Alias (Recommended)

[](#-shell-alias-recommended)

For a better developer experience, add this alias to your shell configuration (`~/.zshrc` or `~/.bashrc`):

```
alias zero='$([ -f zero ] && echo ./zero || echo ./vendor/bin/zero)'
```

Then reload your shell:

```
source ~/.zshrc  # or source ~/.bashrc
```

Now you can use `zero` directly instead of `./vendor/bin/zero`:

```
zero list
zero build
zero pest
```

📖 Usage
-------

[](#-usage)

### 🎯 Application Commands

[](#-application-commands)

```
# List all available application commands
./vendor/bin/zero list

# Run any application command (binary auto-detected from composer.json)
./vendor/bin/zero server:list
./vendor/bin/zero make:command MyCommand
```

### ⚡ Laravel Zero Commands

[](#-laravel-zero-commands)

```
# Run tests
./vendor/bin/zero test

# Build PHAR executable (output in builds/ directory)
./vendor/bin/zero app:build my-app

# Install optional components
./vendor/bin/zero app:install

# Rename your application
./vendor/bin/zero app:rename my-new-name

# Create a new command
./vendor/bin/zero make:command

# Create a new test
./vendor/bin/zero make:test
```

### 🐘 PHP &amp; Composer

[](#-php--composer)

```
# Run PHP commands
./vendor/bin/zero php -v
./vendor/bin/zero php script.php

# Run Composer commands
./vendor/bin/zero composer install
./vendor/bin/zero composer require vendor/package
./vendor/bin/zero composer update
```

### 🧪 Testing &amp; Code Style

[](#-testing--code-style)

```
# Run Pest tests
./vendor/bin/zero pest
./vendor/bin/zero pest --filter=MyTest
./vendor/bin/zero pest --coverage

# Run Pint code style fixer
./vendor/bin/zero pint
./vendor/bin/zero pint --test      # Check without fixing
./vendor/bin/zero pint --dirty     # Only changed files
./vendor/bin/zero pint app/        # Specific directory
```

### 🐚 Container Access

[](#-container-access)

```
# Start an interactive shell
./vendor/bin/zero shell
./vendor/bin/zero bash
```

### 🐳 Docker Management

[](#-docker-management)

```
# Build the Docker image
./vendor/bin/zero build

# Rebuild without cache
./vendor/bin/zero build --no-cache
```

⚙️ Configuration
----------------

[](#️-configuration)

### Environment Variables

[](#environment-variables)

Create a `.env` file at your project root:

```
# PHP version (8.2, 8.3, or 8.4)
PHP_VERSION=8.3

# UID/GID for file permissions (match your local user)
ZEROUSER=1000
ZEROGROUP=1000
```

### 🏷️ Multiple Projects

[](#️-multiple-projects)

By default, all Laravel Zero projects using the same PHP version share the same Docker image (`zero-8.3/app`). This is efficient for most use cases since the image only contains PHP and system extensions, while your code and dependencies are mounted via volumes.

However, if you need to customize the Docker image for a specific project (e.g., adding extra PHP extensions), you can isolate it by setting `COMPOSE_PROJECT_NAME` in your `.env`:

```
COMPOSE_PROJECT_NAME=my-project
```

This will create a separate image named `my-project-zero-8.3/app`, preventing conflicts with other projects.

### Docker Compose

[](#docker-compose)

The default `docker-compose.yml`:

```
services:
    laravel.zero:
        build:
            context: ./vendor/dimer47/zero/runtimes/${PHP_VERSION:-8.3}
            dockerfile: Dockerfile
            args:
                ZEROGROUP: '${ZEROGROUP:-1000}'
                ZEROUSER: '${ZEROUSER:-1000}'
        image: zero-${PHP_VERSION:-8.3}/app
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        environment:
            ZEROUSER: '${ZEROUSER:-1000}'
            ZEROGROUP: '${ZEROGROUP:-1000}'
        volumes:
            - '.:/var/www/html'
        networks:
            - zero
networks:
    zero:
        driver: bridge
```

🔧 How It Works
--------------

[](#-how-it-works)

Unlike Laravel Sail which runs a persistent container, Zero uses **ephemeral containers** optimized for CLI workflows:

1. 📦 Each command spawns a new container
2. ⚡ The command executes
3. 🗑️ The container is automatically removed

This approach is more efficient for CLI applications where you run occasional commands rather than maintaining a web server.

### 🎯 Binary Auto-Detection

[](#-binary-auto-detection)

Zero automatically reads your `composer.json` to find your application binary:

```
{
    "bin": ["my-app"]
}
```

This means `./vendor/bin/zero list` will execute `php my-app list` inside the container.

🔌 PHP Extensions
----------------

[](#-php-extensions)

The Docker images include essential extensions for Laravel Zero:

- PDO / PDO MySQL
- Zip
- MBString
- Intl
- PCntl
- BCMath

The images also include useful system tools: `git`, `curl`, `jq` (JSON parsing), `composer`.

### Adding Extensions

[](#adding-extensions)

To add more PHP extensions, create your own Dockerfile extending the base image, or copy the runtime to your project and customize it.

📚 Command Reference
-------------------

[](#-command-reference)

CommandDescription`zero`Display help`zero list`List all application commands`zero `Run application command`zero build`Build Docker image`zero php ...`Run PHP command`zero composer ...`Run Composer command`zero pest ...`Run Pest tests`zero pint ...`Run Pint code fixer`zero shell`Start interactive shell`zero test`Run application tests`zero app:build`Build PHAR executable`zero app:install`Install optional components`zero app:rename`Rename application`zero make:command`Create new command`zero make:test`Create new test⚖️ Comparison with Laravel Sail
-------------------------------

[](#️-comparison-with-laravel-sail)

FeatureLaravel SailZeroTargetWeb applicationsCLI applicationsContainer modelPersistent (up/stop)Ephemeral (run/exit)Base imageUbuntu (~1GB)Alpine (~50MB)ServicesMySQL, Redis, etc.PHP onlyBinary detection`artisan` hardcodedAuto from `composer.json`🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License
---------

[](#-license)

This package is open-source software licensed under the [MIT license](LICENSE.md).

🙏 Credits
---------

[](#-credits)

- Inspired by [Laravel Sail](https://github.com/laravel/sail) by Taylor Otwell
- Adapted for Laravel Zero by [Dimitri Iachi](https://github.com/dimer47)

🆘 Support
---------

[](#-support)

- [Laravel Zero Documentation](https://laravel-zero.com/)
- [GitHub Issues](https://github.com/dimer47/zero/issues)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance78

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

116d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a83b52919eaea900b98f8738a168c8ce47ecf7a90853959e1ad1af70246d3cfe?d=identicon)[dimer47](/maintainers/dimer47)

---

Top Contributors

[![dimer47](https://avatars.githubusercontent.com/u/12893613?v=4)](https://github.com/dimer47 "dimer47 (4 commits)")

---

Tags

clilaravel-zerodocker

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dimer47-zero/health.svg)

```
[![Health](https://phpackages.com/badges/dimer47-zero/health.svg)](https://phpackages.com/packages/dimer47-zero)
```

###  Alternatives

[laravel/sail

Docker files for running a basic Laravel application.

1.9k186.9M1.0k](/packages/laravel-sail)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[nunomaduro/laravel-console-menu

Laravel Console Menu is an output method for your Laravel/Laravel Zero commands.

815412.0k48](/packages/nunomaduro-laravel-console-menu)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[nunomaduro/laravel-console-task

Laravel Console Task is a output method for your Laravel/Laravel Zero commands.

2582.1M11](/packages/nunomaduro-laravel-console-task)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
