Download the PHP package contenir/contenir-maintenance without Composer
On this page you can find all versions of the php package contenir/contenir-maintenance. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download contenir/contenir-maintenance
More information about contenir/contenir-maintenance
Files in contenir/contenir-maintenance
Package contenir-maintenance
Short Description Framework-agnostic maintenance-mode toggle for Contenir CMS — admin writes, Site reads.
License MIT
Informations about the package contenir-maintenance
contenir/contenir-maintenance
Formerly contenir/maintenance; the old package is abandoned in favour of this one.
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 and listeners come from sibling packages such
as contenir/contenir-maintenance-laminas-mvc.
Requirements
- PHP 8.3, 8.4 or 8.5
contenir/contenir-config^2.1, installed automatically;Repository\FileRepositoryreads and writes through it
The 0.x releases, which support PHP 8.1, remain available from the 0.x
branch and v0.* tags; see UPGRADE-2.0.md.
Install
Usage
MaintenanceState
An immutable value with three public readonly properties:
| Property | Type | Meaning |
|---|---|---|
active |
bool |
Whether the Site should serve 503 |
message |
string |
Operator message shown on the 503 page; '' when inactive |
since |
?DateTimeImmutable |
When maintenance was switched on; always null when inactive |
MaintenanceRepositoryInterface
Implementations treat a missing or unreadable backing store as inactive rather than throwing; write failures must throw so the admin UI can show them.
Repository\FileRepository (admin side)
Writes are atomic and invalidate the file's opcache entry (via
contenir/contenir-config). A failed write throws
Contenir\Config\Exception\WriteException, a RuntimeException, with a
message such as Cannot write maintenance state to "...".
File format
FileRepository reads and writes a Laminas/Mezzio-style config file, so
the Site can drop it into config/autoload/ and have it merged into the
application config:
The repository owns only maintenance.state. Other top-level keys, and
sibling keys under maintenance, are preserved on save.
On read:
- a missing, unreadable or unparseable file, or one without
maintenance.state, is inactive; - a falsy
activeis inactive, and any lingering message is dropped; - a non-scalar
messagereads as''; - a missing or unparseable
sincereads asnull.
Repository\InMemoryRepository
Holds state in memory. It is shipped in src/ so Sites can build state from
their merged config without touching the filesystem, and so consumers can use
it in their own tests:
Development
The QA toolchain is contenir/contenir-qa-tools.
Mago is a standalone binary, installed
separately (brew install mago).
License
MIT. See LICENSE.