LARAVEL ZERO

v12.0 — Laravel 12 · PHP 8.2+

A micro-framework for console applications.

Laravel Zero removes the HTTP layer, the routing, the sessions and the views. What remains is a fast, focused foundation for the command-line tools your team actually runs.

Terminal zsh

$ php my-cli migrate:audit

Migration Batch Status
create_users1ran
add_indexes2ran
drop_legacy-pending

3 migrations · 1 pending · 0.08s

Install

composer create-project laravel-zero/laravel-zero my-cli
Dependencies
Laravel components only
Distribution
One standalone PHAR
Testing
Pest, pre-configured
License
MIT, open source

01 — Overview

Six things you get on the first commit.

01

Console kernel

The full Artisan command layer — signatures, arguments, options, prompts and output helpers, unchanged.

02

Service container

Constructor and method injection everywhere, with the same binding and singleton APIs as Laravel.

03

Task scheduling

Declare a schedule on the command itself and drive the entire application from one crontab entry.

04

Compiler

app:build produces a single executable file containing your code, config and vendor tree.

05

Termwind rendering

Style terminal output with utility classes. Tables, tasks, spinners and progress bars included.

06

Pest test suite

A configured test suite from the start, with helpers for exit codes, prompts and output assertions.

02 — Commands

A command is a class. That is the whole model.

Nothing is registered by hand. Drop a class into app/Commands and it becomes part of your application's interface immediately.

make:command Scaffold a new command class
app:rename Rename the compiled binary
app:build Compile a standalone PHAR
app:install Add an optional component
app/Commands/AuditCommand.php PHP
<?php

declare(strict_types=1);

namespace App\Commands;

use Illuminate\Console\Scheduling\Schedule;
use LaravelZero\Framework\Commands\Command;

final class AuditCommand extends Command
{
    protected $signature = 'migrate:audit {--pending}';

    protected $description = 'Audit database migrations';

    public function handle(Auditor $auditor): int
    {
        $rows = $auditor->inspect(
            pendingOnly: (bool) $this->option('pending'),
        );

        $this->table(['Migration', 'Batch', 'Status'], $rows);

        return self::SUCCESS;
    }

    public function schedule(Schedule $schedule): void
    {
        $schedule->command(static::class)->hourly();
    }
}

03 — Distribution

One artifact. No runtime to explain.

Step 1

Write

php my-cli make:command Audit

Add commands until the tool does what your team needs. Test them as you go.

Step 2

Name

php my-cli app:rename audit

Pick the binary name. The entry point and namespaces are rewritten for you.

Step 3

Build

php my-cli app:build

A single executable file appears in builds/. Publish it however you like.

04 — Add-ons

Absent until you ask for them.

php my-cli app:install <addon>
Component Status
database Optional
log Optional
filesystem Optional
dotenv Optional
menu Optional
queue Optional
http Optional
self-update Optional

Get started

Build the tool your team keeps meaning to write.

composer create-project laravel-zero/laravel-zero my-cli