digifactory/laravel-partial-down

Put specific parts of your application in maintenance mode using

v2.0.1 2022-09-14 13:24 UTC

This package is auto-updated.

Last update: 2024-04-14 17:23:08 UTC


README

Latest Version on Packagist MIT Licensed GitHub Workflow Status Quality Score StyleCI Total Downloads

This package provides a command to put a part of your application's routes in maintenance mode. This only affects your HTTP routes, so queues and scheduled tasks will run.

Installation

You can install the package via Composer:

composer require digifactory/laravel-partial-down

Usage

You can define the parts you want to put in maintenance mode in your middlewares you use for a route or group:

Route::group(['prefix' => 'backend', 'middleware' => 'partialDown:backend'], function () { });

Route::get('backend', function () { })->middleware('partialDown:backend');

Now you can use the artisan commands to put this part of your application in maintenance mode:

php artisan partial-down backend

And partial-up to bring it back online:

php artisan partial-up backend

The partial-down command has Laravel's down command signature:

protected $signature = 'partial-down {part}
                                     {--message= : The message for the maintenance mode}
                                     {--retry= : The number of seconds after which the request may be retried}
                                     {--allow=* : IP or networks allowed to access the application while in maintenance mode}';

When a specific part is down and the IP is not allowed an MaintenanceModeException will be thrown, by default Laravel handles this exception with a 503 response. You can customize this, please refer the Laravel documentation for more information.

List used parts

In large applications it can be cumbersome to find all used application parts. You can use the php artisan partial-parts command to view all used parts:

php artisan partial-parts
+--------------+  
| Parts in use |  
+--------------+  
| backend      |  
| frontend     |  
+--------------+

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email helpdesk@digifactory.nl instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.