artgris/maintenance-bundle

Symfony Bundle,用于将您的Symfony网站置于维护模式

安装数量: 64,322

依赖关系: 0

建议者: 0

安全性: 0

星标: 23

关注者: 3

分支: 7

公开问题: 0

类型:symfony-bundle

1.2.4 2024-03-06 07:10 UTC

This package is auto-updated.

Last update: 2024-09-06 08:11:37 UTC


README

Symfony Bundle,用于将您的Symfony网站置于维护模式 - 默认维护页面

安装

1) 下载

composer require artgris/maintenance-bundle

2) 配置Bundle

在以下配置中添加以下配置

config/packages/artgris_maintenance.yaml

artgris_maintenance:
    enable: true                 # Enable|Disable maintenance - default: false
    ips: ["127.0.0.1","::1",...] # IPs allow (prod) - default: []
    response: 503                # Maintenance Page HTTP Status Code - default: 503

3) 覆盖maintenance.html.twig(可选)

templates/bundles/ArtgrisMaintenanceBundle/maintenance.html.twig

示例

{% extends "@!ArtgrisMaintenance/maintenance.html.twig" %}

{% block content %}
    <h1>Site en cours de maintenance</h1>
    <h2>Nous reviendrons bientôt. Désolé pour le dérangement.</h2>
{% endblock %}

用法

开发环境不受维护影响。

  • 启用/禁用维护: enable: true|false
  • 在prod中添加授权IP: ips: ["127.0.0.1","::1",...]
  • 维护页面HTTP状态码: response: 503

别忘了清除prod缓存

php bin/console cache:clear