carteni/maintenance-bundle

Installs: 12

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 1

Open Issues: 1

Type:symfony-bundle

v1.0.0 2017-06-15 07:25 UTC

This package is not auto-updated.

Last update: 2022-05-06 08:14:15 UTC


README

687474703a2f2f7777772e6d756c74696d65646961657870657269656e636573747564696f2e69742f5f63646e2f7075626c69632f6173736574732f6e6c6f676f2e737667

Show your site in maintenance mode. Allow to see the site under maintenance to a list of given IPs.

SensioLabsInsight

Installation

  1. Download the Bundle.
$ composer require carteni/maintenance-bundle
  1. Enable the Bundle in AppKernel.
public function registerBundles()
    {
        $bundles = [
            new \Mes\Misc\MaintenanceBundle\MesMaintenanceBundle(),
        ];
    }
  1. Configure the Bundle.
mes_maintenance:
    enabled: true
    ips_allowed: [10.10.10.0, 10.10.10.1, 10.10.10.2]
    controller: your_custom_controller:controllerAction or leave blank: controller ~.

If you prefer xml:

<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:mes-maintenance="http://multimediaexperiencestudio.it/schema/dic/maintenance"
           xsi:schemaLocation="http://multimediaexperiencestudio.it/schema/dic/maintenance
           http://multimediaexperiencestudio.it/schema/dic/maintenance/maintenance-1.0.xsd">

    <mes-maintenance:config enabled="true">
        <mes-maintenance:ip_allowed>10.10.10.0</mes-maintenance:ip_allowed>
        <mes-maintenance:ip_allowed>10.10.10.1</mes-maintenance:ip_allowed>
        <mes-maintenance:ip_allowed>10.10.10.2</mes-maintenance:ip_allowed>
    </mes-maintenance:config>

</container>

The maintenance template can be overridden in app/Resources/MesMaintenanceBundle/views/index.html.twig

# app/Resources/MesMaintenanceBundle/views/index.html.twig
{% extends '::base.html.twig' %}

{% block body %}
    <h1>Custom Template</h1>
    {% include '@MesMaintenance/maintenance.html.twig' %}
{% endblock %}

You can also override the maintenance.html.twig template in app/Resources/MesMaintenanceBundle/views/maintenance.html.twig

Unit tests and check code style

$ make
$ make test
$ make cs

License

This bundle is under the MIT license. See the complete license in the bundle

Reporting an issue

Issues are tracked in the Github issue tracker.

Enjoy!

♥ ☕ m|e|s