Laravel Zero was created by Nuno Maduro and it is maintained by Nuno Maduro & Harish Toshniwal. Laravel Zero is a micro-framework that provides an elegant starting point for your next console application. Unofficial and customized version of Laravel optimized for building console/shell/command-line applications.
- Build on top of the Laravel 5 components.
- Includes the Database Component.
- Built with PHP 7 using modern coding standards.
- Ships with a standalone compiler.
- Automatic Dependency Injection on commands and support of Laravel 5 Service Providers.
- Supports desktop notifications on Linux, Windows & MacOS.
Requires PHP 7.1+
Simply create a new Laravel Zero project using Composer:
composer create-project --prefer-dist laravel-zero/laravel-zero your-app-name
Your Laravel Zero project will be then created in the your-app-name
folder. Laravel Zero provides a default command placed in the app/DefaultCommand.php
file which will be executed by default. To execute it, run the following command in your app's directory:
php your-app-name
You can rename your app anytime by running the following command in your app directory:
php your-app-name app:rename newName
You may review the documentation of the Artisan Console component on Laravel's Official Website.
Laravel Zero ships with a Database component out of the box to push your console app to the next level. As you might have already guessed it is Laravel's Illuminate Database component that works with the same breeze in Laravel Zero environment too.
To install the components run the following command in your Laravel Zero app directory:
php your-app-name component:install
This will allow you to select the component to install from the list of available components. Right now, only the Database component is available but many more are in the pipeline.
The configuration of your console application goes in config\config.php
. In this file, you should
define your application's list of commands and your Laravel Service Providers in this file.
/*
* Here goes the application name.
*/
'name' => 'Laravel Zero',
/*
* Here goes the application version.
*/
'version' => '1.0.0',
/*
* If true, development commands won't be available as the app
* will be in the production environment.
*/
'production' => false,
/*
* Here goes the application default command.
*
* You may want to remove this line in order to ask the user what command he
* wants to execute.
*/
'default-command' => App\DefaultCommand::class,
/*
* Here goes the application list of commands.
*
* Besides the default command the user can also call
* any of the commands specified below.
*/
'commands' => [
// App\Commands\YourNewCommand::class,
],
/*
* Here goes the application list of Laravel Service Providers.
* Enjoy all the power of Laravel on your console.
*/
'providers' => [
App\Providers\AppServiceProvider::class,
\NunoMaduro\LaravelDesktopNotifier\LaravelDesktopNotifierServiceProvider::class,
],
Your Laravel Zero project, by default, allows you to build a standalone PHAR archive to ease the deployment or the distribution of your project.
php your-app-name app:build <your-build-name>
The build will provide a single phar archive, ready to use, containing all the code of your project and its dependencies.
Note that the generated file will still need a PHP installation respecting your project's requirements (PHP version, extensions, etc.) on the users' computers to be used. You will then be able to execute it directly:
./builds/<your-build-name>
or on Windows:
C:\application\path> php builds\<your-build-name>
- Thank you for considering to contribute to Laravel Zero. All the contribution guidelines are mentioned here.
You can have a look at the CHANGELOG & Releases for constant updates & detailed information about the changes. You can also follow the twitter account for latest announcements or just come say hi!: @laravelzero
Laravel Zero is an open-sourced software licensed under the MIT license.