Download the PHP package churchportal/laravel-scheduled-maintenance without Composer
On this page you can find all versions of the php package churchportal/laravel-scheduled-maintenance. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download churchportal/laravel-scheduled-maintenance
More information about churchportal/laravel-scheduled-maintenance
Files in churchportal/laravel-scheduled-maintenance
Package laravel-scheduled-maintenance
Short Description Schedule maintenance windows and customize the user experience while your Laravel application is down
License MIT
Homepage https://github.com/churchportal/laravel-scheduled-maintenance
Informations about the package laravel-scheduled-maintenance
Laravel Scheduled Maintenance
This package enables you to schedule maintenance windows for your Laravel application, make it easier to notify users about upcoming maintenance, and also customize the user experience for your users while the application is down for maintenance.
It's built in a similar fashion to laravel's preexisting down
and up
commands with support for bypass mode, redirects, and custom HTTP status codes.
NOTE: This package does rely on your database, if you are preforming significant DB work during a maintenance window then you may want to consider using laravel's down
for that work instead.
Installation
Install the package via composer:
Publish the package assets (this will publish the config file, 1 migration, and an example blade view):
Run the migration:
Configuration
The app('maintenance')
singleton
The ScheduledMaintenace
class is bound to the container via the maintenance
key.
These class methods enable you to:
- Check if the application is in maintenance mode:
->isDown()
- Move into maintenance mode:
->down()
- Move out of maintenance mode:
->up()
- Get the currently active maintenance window:
->current()
- Get the next scheduled maintenance window:
->next()
- Get all future maintenance windows:
->scheduled()
- Find a scheduled maintenance window by id or uuid:
->find($id)
- Delete a scheduled maintenance window by id or uuid:
->delete($id)
- Check if you have bypassed maintenance mode:
->inBypassMode()
- Check if there is a notice available for users about upcoming maintenance:
->notice()
Artisan Commands
maintenance:schedule
This command will walk you through the process of creating a new maintenance window. You'll be prompted for information like when the maintenance will start, when users should see a notification about the upcoming maintenance, etc.
maintenance:down
This command will immediately move your application into maintenance mode! When running this command the package will either move your next scheduled maintenance window into an active state or it will create a new record if there isn't one already scheduled.
Options when creating a new record:
--bypass-secret=
Set the bypass secret for this maintenance window--redirect-to=
Configure a redirect for your users while the application is in maintenance mode
maintenance:up
This command will move your application out of maintenance mode
maintenance:upcoming
This command will list all of your future maintenance windows in a table format
maintenance:cancel {id}
This command will delete a scheduled maintenance window
Events
All events include a public $scheduledMaintenace
model property
MaintenanceScheduled
This event is triggered after scheduling maintenance using the maintenance:schedule
command
MaintenanceStarted
This event is triggered after running app('maintenance')->down()
.
There is an additional $wasPreviouslyScheduled
property that will be false if the maintenance was started without being previous scheduled.
MaintenanceCompleted
This event is triggered after running app('maintenance')->up()
MaintenanceCancelled
This event is triggered after running app('maintenance')->delete($id)
Usage
Display notice to users about upcoming maintenance
Using the app('maintenance')->notice()
method you'll have access to the details about the next upcoming maintenance window
in blade
in inerita
Bypassing maintenance mode
You can bypass maintenance mode by navigating to the bypass_secret
url.
It can be useful when testing your application to remember that it's still in maintenance mode.
Here are some examples of how you can implement that notice:
in blade
in inerita
All versions of laravel-scheduled-maintenance with dependencies
calebporzio/sushi Version ^2.2
illuminate/contracts Version ^8.37
spatie/laravel-package-tools Version ^1.4.3