mingalevme / lumen-maintaince by mingalevme

Support for maintaince mode in Lumen
9
0
1
Package Data
Maintainer Username: mingalevme
Maintainer Contact: mingalevme@gmail.com (Mingalev Mikhail)
Package Create Date: 2017-10-04
Package Last Update: 2017-10-04
Language: PHP
License: Apache License 2.0
Last Refreshed: 2024-12-15 15:11:59
Package Statistics
Total Downloads: 9
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

lumen-maintaince

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.