horde/phpconfigfile
Composer 安装命令:
composer require horde/phpconfigfile
包简介
Read and write config files as PHP Code
README 文档
README
Read and write PHP config files with array or primitives data. Provide building blocks for a PHP native schema definition.
Supported formats
Leading and trailing spaces are ignored Opening and closing PHP tags are optional
Classic Horde Format
<?php
$conf['critical_value'] = 'Code before the header is not deleted on write and can act as a default for missing values in the actual config';
/* Some Config File Header*/
$conf['critical_value'] = 'Everything in here is overwritten on write';
$conf['auth']['transparent'] = true;
$other_var = 'debug';
/* Some Config File Footer*/
$conf['critical_value'] = 'Code after the footer is not overwritten on write and can act as a temporary override to admin-provided config';
Random Array Format
<?php
$data = [
'key' => 'value',
'key2' => [
'nested => 'values',
'of_any' => ['possible' => 'format' ],
],
];
Primitives
<?php
$debug = true;
$max_errors = 23;
$initial_application_page = 'News';
?>
Usage
See Unit Tests
Schema Definition
Applications have expectations with regards to PHP config files but free form PHP allows to undermine these expectations. The ConfigurationSchema classes provide building blocks for
- Rendering defaults into a new or incomplete configuration file
- generating UIs from Code without external schema languages like XML, Yaml, etc
- versioning and upgrading configuration files in a defined fashion.
Schema definitions always begin with a root element ConfigurationSchema. Every subsequent element is either a LeafElement or a ParentElement. LeafElements hold primitive values such as integer, string, float, boolean or null. A special type of leaf elements are void elements which do not emit anything to the configuration file but provide metadata for display in a UI assembled from the schema. ParentElements hold levels of array keys
horde/phpconfigfile 适用场景与选型建议
horde/phpconfigfile 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.01k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 horde/phpconfigfile 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 horde/phpconfigfile 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: LGPL-2.1-only
- 更新时间: 2025-05-06