nuboxdevcom / maintenance-bundle
Maintenance bundle for Symfony 3.x 4.x
Installs: 116
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Language:CSS
Type:symfony-bundle
Requires
- php: ^7.1
- symfony/asset: ^3.4|^4.0
- symfony/framework-bundle: ^3.4|^4.0
- symfony/templating: ^3.4|^4.0
- symfony/twig-bundle: ^3.4|^4.0
- symfony/yaml: ^3.4|^4.0
- twig/twig: ^2.4
This package is auto-updated.
Last update: 2021-01-09 17:47:34 UTC
README
Requirements
- PHP
>=7.1
- symfony/framework-bundle
>= 3.4 || ^4.0
- Twig
^2.4
⚠️ Symfony before version 3.4 NOTICE
Please use ^1.x branch versions.
2.x versions is incompatible with versions lower than symfony 3.4
Installation:
Pretty simple with Composer, run:
$ composer require nuboxdevcom/maintenance-bundle
Simply Configuration
Enter your IPs here to allow you to access your site during a maintenance.
In config/ndc_maintenance.yaml
ndc_maintenance: authorized_ips: - '127.0.0.1' - 'your.ip.domain.name.example'
Configuration
Symfony Flex takes care of everything!
How to Use
In your template, add this to let you know if the site is in maintenance
{% if isMaintenanceMode() %} <p class="text-center bg-danger"><strong>Your site is in maintenance mode...</strong></p> {% endif %}
isMaintenanceMode() return boolean true or false.
If you want to activate maintenance mode, you will need to call the following method
$this->get('maintenance.service')->enableMaintenanceAction();
Or
$this->get('maintenance.service')->disableMaintenanceAction();
To disable maintenance mode.
If you want to know if maintenance is enabled from a controller, use this method
$this->get('maintenance.service')->isMaintenanceMode();
isMaintenanceMode() return boolean true or false.
How to change the view of maintenance page
If you want to change the view, create a new view file
templates/bundles/NDCMaintenanceBundle/maintenance.html.twig