mingalevme/lumen-maintaince
Support for maintaince mode in Lumen
9
| Install | |
|---|---|
composer require mingalevme/lumen-maintaince |
|
| PHP: | >=5.4.0 |
| License: | Apache License 2.0 |
| Last Updated: | Oct 4, 2017 |
| Links: | GitHub · Packagist |
Maintainer: mingalevme
lumen-maintaince
Provides support for maintaince mode for Lumen Framework.
Installation
composer require mingalevme/lumen-maintaince.- Register the service provider
Mingalevme\Lumen\Maintaince\MaintainceServiceProvider. - Replace Lumen Application class with one of the following:
3.1. You can directly use class
Mingalevme\Lumen\Maintaince\Applicationin you/bootstrap/app.phpinstead ofLaravel\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__.'/../')
);
// ...
- Now you are able to use
artisan downandartisan upcommands:
$ 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.