定制 contenir/maintenance 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

contenir/maintenance

最新稳定版本:v0.1.1

Composer 安装命令:

composer require contenir/maintenance

包简介

Framework-agnostic maintenance-mode toggle for Contenir CMS — admin writes, Site reads.

README 文档

README

Framework-agnostic maintenance-mode toggle for Contenir CMS.

The CMS writes a maintenance flag (and optional message); the consuming Site (Mezzio, Laminas MVC, anything else) reads it on every request and returns 503 with the message until the flag is cleared.

This package provides the domain — a small immutable state value plus a repository interface, with file-based and in-memory implementations. Framework-specific middleware/listeners come from sibling packages.

Install

composer require contenir/maintenance

Zero runtime dependencies — pure PHP 8.1+.

Usage

Reading state

use Contenir\Maintenance\Repository\FileRepository;

$repo = new FileRepository('/var/www/shared/maintenance.local.php');
$state = $repo->get();

if ($state->active) {
    // Render 503 with $state->message
}

Writing state (admin)

use Contenir\Maintenance\MaintenanceState;

$repo->save(MaintenanceState::active('Back online by 5pm AEST.'));

// ... later ...
$repo->save(MaintenanceState::inactive());

File format

FileRepository reads/writes a PHP file that returns an array:

<?php

return [
    'active' => true,
    'message' => 'Back online by 5pm AEST.',
    'since' => '2026-05-05T03:14:15+00:00',
];

A missing or unreadable file resolves to inactive state, so first-run and permission edge cases don't crash the consumer.

Testing

InMemoryRepository is shipped in src/ so consumers can use it in their own test suites:

use Contenir\Maintenance\Repository\InMemoryRepository;
use Contenir\Maintenance\MaintenanceState;

$repo = new InMemoryRepository(MaintenanceState::active('Down'));

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固