Skip to content

LaSyntax/SymfonyMaintenanceListener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SymfonyMaintenanceListener


This short snippet aim to easily handle setting a Symfony 5.*+ website to maintenance mode.

Certain users with defined roles can continue surfing on the site, usefull to allow team to test the app even in maintenance (See comments in MaintenanceListener.php file).

Please follow simply these steps to set up maintenance feature on your symfony powered website:

Set params

Copy the content of services.yaml (in this repo) to your config/services.yaml

MaintenanceListener

Create src/Services/Listener/MaintenanceListener.php and copy the content of MaintenanceListener.php in it.

  • Don't forget to customize your $allowRoutesInMaintenance to serve certains routes to public even in maintenance (login, etc)
  • This is important for you (admin or team), to authenticate yourself before having full access to the site in maintenance
  • Don't forget to set your twig templates path correctly.

Register the Listener

Register your Listener in your config/services.yaml file or copy the content of services.yaml to your config/services.yaml

Twig

Create a twig template to server publicly in maintenance mode or see the maintenance.html.twig file in this repo

GitHub Repo stars GitHub last commit

Happy hacking

Thank to be eP

About

Setup maintenance mode with symfony app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published