Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bretrzaun/maintenancebundle
Maintenance bundle for Symfony applications
https://github.com/bretrzaun/maintenancebundle
maintenance-mode php symfony symfony-bundle
Last synced: 3 months ago
JSON representation
Maintenance bundle for Symfony applications
- Host: GitHub
- URL: https://github.com/bretrzaun/maintenancebundle
- Owner: bretrzaun
- License: mit
- Created: 2018-11-21T15:47:03.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-05T09:47:49.000Z (about 1 year ago)
- Last Synced: 2024-10-12T11:08:32.128Z (4 months ago)
- Topics: maintenance-mode, php, symfony, symfony-bundle
- Language: PHP
- Homepage:
- Size: 88.9 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Maintenance Bundle
[![Tests](https://github.com/bretrzaun/MaintenanceBundle/actions/workflows/tests.yml/badge.svg)](https://github.com/bretrzaun/MaintenanceBundle/actions/workflows/tests.yml)
[![Latest Stable Version](https://poser.pugx.org/bretrzaun/maintenance-bundle/v/stable)](https://packagist.org/packages/bretrzaun/maintenance-bundle)
[![Total Downloads](https://poser.pugx.org/bretrzaun/maintenance-bundle/downloads)](https://packagist.org/packages/bretrzaun/maintenance-bundle)
[![License](https://poser.pugx.org/bretrzaun/maintenance-bundle/license)](https://packagist.org/packages/bretrzaun/maintenance-bundle)## Installation
```
composer require bretrzaun/maintenance-bundle
```Register bundle in `config/bundles.php`:
```php
\BretRZaun\MaintenanceBundle\MaintenanceBundle::class => ['all' => true]
```## Configuration
Create the following configuration file
```yaml
# config/packages/maintenance.yaml
maintenance:
enabled: false
template: 'maintenance.html.twig'
#from: 01.12.2018 00:00:01
#until: 03.12.2018 00:00:01
allowed_ip: ['10.*.*.*']
```### Options
- **enabled**: if set to `true` manually activates the maintenance mode
- **template**: template to render, when maintenance mode is activated
- **from**: begin maintenance mode at the given date/time (only when 'enabled' is false)
- **until**: end maintenance mode at the given date/time (only when 'enabled' is false)
- **allowed_ip**: list of IP addresses who can access the application even in maintenance mode## Template
The bundle has a default maintenance template (see `src/Resources/views/maintenance.html.twig`).
You can use your own template (see configuration). In case your maintenance template extends from a parent layout
you might want to exclude certain parts while in maintenance (e.g. a menu).
This can be done with like so:
```twig
{% if not maintenance_mode() %}
...
{% endif %}
```If the option "allowed_ip" is used, certain users can access the application even it is in maintenance mode.
To make these users aware of this you can add the following to the layout template:```twig
{% if maintenance_mode_allowed() %}
Maintenance mode is activated!
{% endif %}
```