carteni / maintenance-bundle
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 1
Type:symfony-bundle
Requires
- php: ^5.5.9 || ^7.0
- symfony/framework-bundle: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^1.11
- phpunit/phpunit: ~4.8|~5.0
- symfony/console: ^3.2
- symfony/phpunit-bridge: ^3.2
This package is not auto-updated.
Last update: 2024-11-15 20:01:00 UTC
README
Show your site in maintenance mode. Allow to see the site under maintenance to a list of given IPs.
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:
<?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.