, (*1)
Show your site in maintenance mode. Allow to see the site under maintenance to a list of given IPs., (*2)
, (*3)
Installation
- 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:, (*4)
<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
, (*5)
# app/Resources/MesMaintenanceBundle/views/index.html.twig
{% extends '::base.html.twig' %}
{% block body %}
Custom Template
{% include '@MesMaintenance/maintenance.html.twig' %}
{% endblock %}
You can also override the maintenance.html.twig
template in app/Resources/MesMaintenanceBundle/views/maintenance.html.twig
, (*6)
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, (*7)
Reporting an issue
Issues are tracked in the [Github issue tracker][1]., (*8)
Enjoy!
♥ ☕ m|e|s