Show your site in maintenance mode. Allow to see the site under maintenance to a list of given IPs.
- Download the Bundle.
$ composer require carteni/maintenance-bundle
- Enable the Bundle in
AppKernel
.
public function registerBundles()
{
$bundles = [
new \Mes\Misc\MaintenanceBundle\MesMaintenanceBundle(),
];
}
- 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
$ make
$ make test
$ make cs
This bundle is under the MIT license. See the complete license in the bundle
Issues are tracked in the Github issue tracker.