Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Maintenance Bundle Laravel Package

devtia/maintenance-bundle

View on GitHub
Deep Wiki
Context7

MaintenanceBundle

This bundle allows you to display a custom template when your site is under maintenance with a simple change in the parameters and a rapid deployment. This allows you to correct any errors in your application and inform your users almost immediately.

You can also define only some routes (with PHP regex) to display the message.

Installation

Download the Bundle.

composer require "devtia/maintenance-bundle"

Enable the Bundle

// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new  Devtia\MaintenanceBundle\MaintenanceBundle(),
        );

        // ...
    }

    // ...
}

Usage

You need put something like this in your config.yml

maintenance:
  #default false. Set to true for enable the bundle and deploy your code
  enable_maintenance: false 
  #not required. You can set multiple routes and a custom template for each one. The routes must be compatible with PHP regex but without initial and end slash ('/')
  routes_prefixes:
    - ['\/admin\/', '%kernel.project_dir%/src/Resources/views/Maintenance/custom_maintenance.html.twig'] #if you left second parameter empty, the bundle use the default template
            

Template functionallity

The bundle provides a default template like this:

screenshot

You can create a custom template creating a file at this path:

ROOT_PATH_TO_YOUR_PROJECT . '/app/Resources/Devtia/MaintenanceBundle/views/maintenance.html.twig

If you want more control of your template or need more than one you can define multiple templates in the configuration.

Each template need to be related to a Regex for a group of routes. In the configuration example, the bundle shows the custom_maintenance.html.twig template in all routes that match with 'admin' pattern.

Regex

You can learn about PHP regex in this link and try them here.

The MaintenanceBundle simplifies the configuration add to ALL your routes_prefixes the initial and end slash ('/') and the wildcard .* at the end. With the configuration example shows above, the bundle create this regex:

/\/admin\/.*/

This example match with routes like '/admin/', '/admin/login', '/admin/users/create',...

Contact

You can contact with me on jaime@devtia.com.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor