Skip to content

panahbiru/laravel-zero

 
 

Repository files navigation

StyleCI Status Build Status Quality Score Latest Stable Version Software License

About Laravel Zero

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.

Installation & Usage

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.

Components

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.

Configuration

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,
        ],

Building a standalone application

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>

Contributing

  • Thank you for considering to contribute to Laravel Zero. All the contribution guidelines are mentioned here.

Stay In Touch

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

Credits

Laravel Zero uses code from several open source projects.

License

Laravel Zero is an open-sourced software licensed under the MIT license.

About

🍹Laravel Zero is a micro-framework that provides an elegant starting point for your next console application.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%