congnqnexlesoft / symfony-maintenance-mode by congnqnexlesoft

A custom maintenance mode for Symfony
27
0
1
Package Data
Maintainer Username: congnqnexlesoft
Maintainer Contact: congnqnexlesoft@gmail.com (Cong Nguyen Quang)
Package Create Date: 2024-05-15
Package Last Update: 2024-05-15
Language: PHP
License: MIT
Last Refreshed: 2024-09-28 03:00:35
Package Statistics
Total Downloads: 27
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

Symfony maintenance mode

  • The module is built upon the https://github.com/rdehnhardt/lumen-maintenance-mode package and customized for Symfony 4.4 and PHP 7.2

How to install

composer require congnqnexlesoft/symfony-maintenance-mode

How to configure

In config/services.yaml, add this instruction in services providers

    # [BEGIN] congnqnexlesoft/lumen-maintenance-mode
    CongnqNexlesoft\MaintenanceMode\ConsoleCommand\MaintenanceMode\DownCommand:
      class: CongnqNexlesoft\MaintenanceMode\ConsoleCommand\MaintenanceMode\DownCommand
      tags: [ 'console.command' ]
    CongnqNexlesoft\MaintenanceMode\ConsoleCommand\MaintenanceMode\UpCommand:
      class: CongnqNexlesoft\MaintenanceMode\ConsoleCommand\MaintenanceMode\UpCommand
      tags: [ 'console.command' ]
    CongnqNexlesoft\MaintenanceMode\MaintenanceModeService:
      autowire: true
    CongnqNexlesoft\MaintenanceMode\Http\Middleware\MaintenanceModeMiddleware:
      class: CongnqNexlesoft\MaintenanceMode\Http\Middleware\MaintenanceModeMiddleware
      arguments:
        - '@CongnqNexlesoft\MaintenanceMode\MaintenanceModeService'
      tags:
        - { name: kernel.event_listener, event: kernel.request, method: onRequest }
    # [END] congnqnexlesoft/lumen-maintenance-mode

Response

Using JSON

  • Require config the line below to your .env file
## congnqnexlesoft/lumen-maintenance-mode ##
MAINTENANCE_RESPONSE_FORMAT=json

Copy these files to your project (if):

public/.gitignore

Put the application into maintenance mode (Symfony)

php bin/console down

Bring the application out of maintenance mode (Symfony)

php bin/console up

DevOps

Release a new version

sh .ops/release-a-new-version.sh