mingalevme/lumen-maintaince

Support for maintaince mode in Lumen

dev-master 2017-10-04 09:25 UTC

This package is auto-updated.

Last update: 2024-12-08 02:31:01 UTC


README

Provides support for maintaince mode for Lumen Framework.

Installation

  1. composer require mingalevme/lumen-maintaince.
  2. Register the service provider Mingalevme\Lumen\Maintaince\MaintainceServiceProvider.
  3. Replace Lumen Application class with one of the following: 3.1. You can directly use class Mingalevme\Lumen\Maintaince\Application in you /bootstrap/app.php instead of Laravel\Lumen\Application:
<?php // /bootsrap/app.php

// ...

/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| Here we will load the environment and create the application instance
| that serves as the central piece of this framework. We'll use this
| application as an "IoC" container and router for this framework.
|
*/

$app = new Mingalevme\Lumen\Maintaince\Application(
    realpath(__DIR__.'/../')
);

// ...

3.2. OR you can use the trait Mingalevme\Lumen\Maintaince\Maintaince for your own Application class:

<?php // /app/Helpers/Laravel/Lumen/Application.php

namespace App\Helpers\Laravel\Lumen;

use Mingalevme\Lumen\Maintaince\Maintaince;

class Application extends \Laravel\Lumen\Application
{
    use Maintaince;
}
<?php // /bootsrap/app.php

// ...

/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| Here we will load the environment and create the application instance
| that serves as the central piece of this framework. We'll use this
| application as an "IoC" container and router for this framework.
|
*/

$app = new App\Helpers\Laravel\Lumen\Application(
    realpath(__DIR__.'/../')
);

// ...
  1. Now you are able to use artisan down and artisan up commands:
$ php artisan list
# ...
Available commands:
    # ...
    down                Put the application into maintenance mode
    up                  Bring the application out of maintenance mode
    # ...
# ...
$ php artisan down
Application is now in maintenance mode.
$ php artisan up
Application is now live.