laravel-zero
Create console applications using the Laravel framework
TLDR
Create a new Laravel Zero application
Update the installer to the latest version
List the available installer commands
SYNOPSIS
laravel-zero [global_options] <command> [arguments] [options]
This syntax applies when the Laravel Zero application executable is named 'laravel-zero' or symlinked globally. Alternatively, within a project, it's commonly run via 'php <your-app-name> ...' (where <your-app-name> is typically 'application').
PARAMETERS
--help | -h
Displays help for the current command or all commands.
--quiet | -q
Do not output any message.
--verbose | -v | -vv | -vvv
Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
--version | -V
Display this application version.
--no-interaction | -n
Do not ask any interactive question.
--env[=ENV]
The environment the command should run under (e.g., 'production', 'local').
DESCRIPTION
Laravel Zero is a micro-framework built on top of the powerful Laravel components, specifically designed for creating elegant and robust console applications. It provides a minimal yet complete environment for command-line interface (CLI) tools, leveraging Laravel's familiar syntax, dependency injection, and Artisan console commands. Ideal for building custom scripts, standalone CLI utilities, or managing background processes without the overhead of a full web application. It offers features like task scheduling, database integration, and command-line prompts, making complex CLI development simpler and more efficient. Laravel Zero empowers developers to craft professional console applications with speed and ease.
CAVEATS
Laravel Zero is a PHP application and therefore requires a PHP environment (PHP 8.1+ recommended) and Composer for dependency management. It is not a built-in Linux utility. The available commands are specific to the Laravel Zero application being executed, not general system commands. It relies on a properly configured PHP CLI environment.
INSTALLATION
Laravel Zero applications are typically installed via Composer. To create a new project, execute:
composer create-project nunomaduro/laravel-zero my-cli-app
Once installed, the main executable is usually found at ./my-cli-app/application within your project directory, or it can be symlinked globally for easier access (e.g., my-cli-app).
COMMON USAGE
After creating a new Laravel Zero project, you can define your own custom commands using the familiar Artisan command generation:
php application make:command MyCustomCommand
To execute your custom commands or any built-in Laravel Zero/Artisan commands, you would typically run:
php application <command_name> [arguments] [options]
For example, to run database migrations: php application migrate, or to schedule tasks: php application schedule:run.
HISTORY
Laravel Zero was created by Nuno Maduro, a prominent contributor to the Laravel ecosystem, and publicly launched in 2017. Its development aimed to provide a lightweight alternative to the full Laravel framework for building console-only applications, reusing Laravel's robust components like Eloquent ORM, Cache, and Filesystem, without the HTTP overhead. It quickly gained popularity for its simplicity and efficiency in developing CLI tools, maintaining an active development community and regular updates in sync with Laravel's releases.