contenir/config
Composer 安装命令:
composer require contenir/config
包简介
Framework-agnostic PHP-array config file reader/writer with atomic writes and opcache invalidation. Adapted from Laminas\Config.
README 文档
README
Framework-agnostic PHP-array config file reader and writer for Contenir CMS.
Reads and writes the <?php return [...]; config files that get merged into a Laminas/Mezzio site's configuration. Designed for the admin-writes / Site-reads pattern used by sibling packages like contenir/cache, contenir/maintenance, and contenir/errors.
The reader is tolerant — a missing, unreadable, or syntactically broken file resolves to an empty array rather than throwing, so first-run consumers can ask for state before any has been written. The writer is atomic — partial writes are never visible to readers, and concurrent writers can't race during the write/rename window.
Install
composer require contenir/config
Requires PHP 8.1+.
Usage
Reading
use Contenir\Config\Reader\PhpArray as ConfigReader; $config = ConfigReader::fromFile('/var/www/shared/pagecache.local.php');
$config is always an array — empty if the file doesn't exist, is unreadable, or contains a parse error.
Writing
use Contenir\Config\Writer\PhpArray as ConfigWriter; ConfigWriter::toFile($path, $config);
The optional third argument is a domain label that gets interpolated into error messages — sibling packages pass things like 'cache control', 'maintenance state', 'error pages' so failures surface with consumer-meaningful wording. Save errors throw Contenir\Config\Exception\WriteException, which extends \RuntimeException.
contenir/config 适用场景与选型建议
contenir/config 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 contenir/config 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 contenir/config 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 34
- 依赖项目数: 3
- 推荐数: 3
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-08