bretrzaun/maintenance-bundle
Composer 安装命令:
composer require bretrzaun/maintenance-bundle
包简介
Bundle for maintenance switch in Symfony applications
README 文档
README
Installation
composer require bretrzaun/maintenance-bundle
Register bundle in config/bundles.php:
\BretRZaun\MaintenanceBundle\MaintenanceBundle::class => ['all' => true]
Configuration
Create the following configuration file
# config/packages/maintenance.yaml maintenance: enabled: false template: 'maintenance.html.twig' # Maintenance window start from: 2018-12-01 00:00:00 # Maintenance window end until: 2018-12-03 00:00:00 # IP addresses allowed to access during maintenance # Supports: # - Wildcards: 10.*.*.* or 192.168.*.* # - CIDR notation: 192.168.1.0/24 # - IPv6: 2001:db8::/32 # - Exact IPs: 192.168.1.1 allowed_ip: - '10.*.*.*' # All 10.x.x.x IPs - '192.168.1.0/24' # Entire /24 network - '2001:db8::/32' # IPv6 network - '203.0.113.42' # Single IP
Options
- enabled: if set to
truemanually 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:
{% 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:
{% if maintenance_mode_allowed() %}
<div class="alert alert-warning">Maintenance mode is activated!</div>
{% endif %}
bretrzaun/maintenance-bundle 适用场景与选型建议
bretrzaun/maintenance-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38.57k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2018 年 11 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bretrzaun/maintenance-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bretrzaun/maintenance-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 38.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-21