el-schneider/statamic-maintenance-mode 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

el-schneider/statamic-maintenance-mode

最新稳定版本:v0.1.0

Composer 安装命令:

composer require el-schneider/statamic-maintenance-mode

包简介

Set your statamic site into maintenance mode

README 文档

README

Auto Alt Text

Statamic Maintenance Mode

Manage maintenance mode through Statamic's control panel using Laravel's native maintenance system

Features

  • Laravel Native: Uses Laravel's built-in artisan down/up commands, supporting all standard options like retry headers, refresh intervals, and secret bypass URLs
  • Flexible Display: Show any Statamic entry as your maintenance page, or use Laravel's default 503 error template
  • Bypass URLs: Generate shareable secret URLs that grant access during maintenance
  • Page Whitelisting: Keep specific entries accessible while the rest of the site is down
  • CP and CLI: Manage maintenance mode through the control panel or terminal interchangeably

Installation

composer require el-schneider/statamic-maintenance-mode

Usage

Navigate to Utilities > Maintenance in the control panel to configure and activate maintenance mode.

Control panel users with "access cp" permission can browse the frontend during maintenance.

Configuration

Publish the configuration file:

php artisan vendor:publish --tag=statamic-maintenance-mode-config

Refer to the published configuration file (config/statamic/maintenance-mode.php) for available options.

Customizing the Error Page

When no Statamic entry is selected, visitors see Laravel's default 503 error page.

To customize it, publish Laravel's error templates:

php artisan vendor:publish --tag=laravel-errors

Then edit resources/views/errors/503.blade.php.

Static Caching

When using Statamic's full measure static caching, your web server serves pre-rendered HTML files directly, bypassing PHP entirely. This means Laravel's maintenance mode check won't run for cached pages.

To ensure maintenance mode works correctly, modify your server config to skip static file serving when the down file exists. This forces requests through PHP where Laravel can handle maintenance mode properly.

Nginx:

set $try_static_files = "";

if (-f $document_root/../storage/framework/down) {
    set $try_static_files "skip";
}

if (-f "${document_root}/static${uri}_${query_string}.html") {
    set $try_static_files "${try_static_files}+exists";
}

if ($try_static_files = "+exists") {
    rewrite ^(.*)$ /static$1_$query_string.html last;
}

Apache (.htaccess):

RewriteCond %{DOCUMENT_ROOT}/../storage/framework/down !-f
RewriteCond %{DOCUMENT_ROOT}/static%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* static%{REQUEST_URI}_%{QUERY_STRING}.html [L,T=text/html]

Half measure static caching works without server configuration since requests still pass through PHP.

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04