Download the PHP package misterphilip/maintenance-mode without Composer

On this page you can find all versions of the php package misterphilip/maintenance-mode. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package maintenance-mode

Enhanced Laravel Maintenance Mode

This package is a drop-in replacement for Laravel's maintenance mode. The following versions are supported:

Features include:

Table of Contents

  1. Installation
  2. Changes from 1.0
  3. Usage
  4. Configuration
    1. Default Configuration
    2. Overriding Defaults
  5. Exemptions
    1. Default Exemptions
      1. IP Whitelist
      2. Environment Whitelist
    2. Creating a New Exemption
  6. Views
    1. Application Down
    2. Maintenance Notification
  7. Events

Installation

Run the following command to install the latest:

Or, if you prefer installing it manually, within composer.json add the following line to the end of the require section:

And then run the Composer install command:

Laravel should automatically install the Service Providers, but verify they exist within the config/app.php file. If they do not, add MisterPhilip\MaintenanceMode\MaintenanceModeServiceProvider::class, and MisterPhilip\MaintenanceMode\MaintenanceCommandServiceProvider::class, to the end of the $providers array in your config/app.php:

Finally, in app/Http/Kernel.php replace the current MaintenanceMode Middleware

with

Changes from 1.0

Since Laravel 5.3, messages are now allowed in the default artisan down command, as well as adding an option for the Retry-After HTTP header. Because of this it should be noted that the syntax to call the artisan down command has changed from the 1.0 branch to better match Laravel's default command.

Additionally, we've changed the MaintenanceModeEnabled event to no longer use the info property, but instead have separate properties for each piece of information. See more in the events section.

Usage

This package overwrites the default artisan down command, with more options:

For example,

would show users a message of "We're doing some routine maintenance! Be back soon!". If you don't pass in a message, the default "We're currently working on the site, please try again later" will display to the users. Of course this default is configurable via a language string.

You can also change the view that is shown each time you run the artisan down command via the --view=[VIEW] option:

And of course you can use the default --retry option as well:

To bring your application back online, run the normal app up command:

NOTE: by default, two exemptions enabled, which means that if you run your development server locally (127.0.0.1) or you have APP_ENV=local in your .env file, you will not see the maintenance page. You can remove these exemptions via the configuration.

Configuration

This package is a drop-in replacement for the default maintenance mode provided with Laravel 5. This means that you do not have to do any configuration out-of-the-box. However, if you'd like to tweak some of the settings, there are a number of configuration values that are available to make this package a better fit for your application.

Default Configuration

Below are the default configuration options and a short description on each. Don't worry, all of this information is within the configuration file too!

Overriding Defaults

If you need to override the default configuration values, run the following command:

Now you can edit the values at config/maintenancemode.php.

Exemptions

Exemptions allow for select users to continue to use the application like normal based on a specific set of rules. Each of these rule sets are defined via a class which is then executed against.

Default Exemptions

By default, an IP whitelist and an application environment whitelist are included with this package to get you off the ground running. Additionally, more examples are provided for various types of exemptions that might be useful to your application.

IP Whitelist

This exemption allows you to check the user's IP address against a whitelist. This is useful for always including your office IP(s) so that your staff doesn't see the maintenance page. This is similar to the allow option that is offered in Laravel 5.6+ (and is backported to 5.5 with this package), however the allow option requires you to pass the IPs every time, vs. this method allows for you to have IPs stored in the configuration. Both methods can be used with each other, e.g. a static internal network should always be allowed via the config, while an additional IP for a vendor or remote employee can temporarily be added via the allow option.

Configuration values included with this exemption are:

Environment Whitelist

This exemption allows you to check if the current environment matches against a whitelist. This is useful for local development where you might not want to see the maintenance page.

Configuration values included with this exemption are:

Creating a new exemption

Setting up a new exemption is simple:

  1. Create a new class and extend MisterPhilip\MaintenanceMode\Exemptions\MaintenanceModeExemption. You might consider creating these files in app\Exemptions or app\Infrastructure\Maintenance, but you're free to place them where you want.
  2. This class must include an isExempt method. This method should return true if the user should not see the maintenance page. If this returns false, it indicates that the user does not match your ruleset and other exceptions should be checked.
  3. Add the full class name to the exemptions array in the configuration file.

Below is an template to use for a new exemption class SampleExemption:

Views

There are 2 views included with this package: an "application down" page that replaces the current "Be right back!" page, and a "maintenance notification" which is a notification bar that tells exempted users that the application is in maintenance mode.

You can also publish these views so that you can edit them easily. The command below will publish the views to resources/views/vendor/maintenancemode/*. Once published be sure to change the config values (view) to point to the new file location.

Application Down

The default maintenance page, maintenancemode::app-down

Included is a default view that displays your custom message and a timestamp for your users. To change this page, update the view configuration value to point to the new view. The following variables are available for you to use:

NOTE: If you've changed the inject.prefix configuration value, you'll need to reflect this change in the variable names above. For example, if inject.prefix = "Foobar", your view variables would be $FoobarEnabled, $FoobarMessage, and $FoobarTimestamp.

NOTE: By default, these variables are available in all views. To disable this functionality and have it only inject variables on the maintenance page, change the inject.global configuration value to false.

You can also temporarily override the view shown by passing in the --view option when calling the artisan down command. E.g. if you wanted to use the default errors/503.blade.php view, you could call:

Maintenance Notification

The optional maintenance notification, maintenancemode::notification

We've included a maintenance notification for users that want to include a notice to those that are exempt from seeing the maintenance page. We've found that as an admin, it's helpful to know when your application is in maintenance mode in the event that you've forgotten to disable it or it was turned on automatically.

You can enable this notification by placing the following code within your main blade layouts file(s):

Events

This package fires an event, MisterPhilip\MaintenanceMode\Events\MaintenanceModeEnabled, whenever the application goes down for maintenance, and MisterPhilip\MaintenanceMode\Events\MaintenanceModeDisabled when it is brought back up. You can add your own listeners in your events Service Provider. By default this is located at app/providers/EventServiceProvider.php. You can find several example listeners in the events examples, including logging when the application went down or up, and updating Statuspage via the checkitonus/php-statuspage-sdk package.

The original message, time the app went down, retry length, view, and allowed are all properties available on both events.


All versions of maintenance-mode with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
illuminate/support Version >=5.5
nesbot/carbon Version ^1.24 || ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package misterphilip/maintenance-mode contains the following files

Loading the files please wait ....