silencenjoyer/silence-config 问题修复 & 功能扩展

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

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

silencenjoyer/silence-config

最新稳定版本:0.0.3

Composer 安装命令:

composer require silencenjoyer/silence-config

包简介

Silence application configuration.

README 文档

README

Latest Stable Version PHP Version Require License

This package is designed to read the configuration and interact with it.

The package provides two main entities: \Silence\Config\AppConfig for working with application parameters, and \Silence\Config\AppContext for storing important application context settings: environment, locale, etc.

This package is part of the monorepository silencenjoyer/silence, but can be used independently.

⚙️ Installation

composer require silencenjoyer/silence-config

🚀 Quick start

# Config
// main.php
<?php

return [
    'data' => ['qwerty' => 1, 'test' => 2]
];
...

use Silence\Config\AppConfigFactory;

$config = AppConfigFactory::create('dev', 'path/to', ['main']);
$data = $config->get('data'); // ['qwerty' => 1, 'test' => 2]
# Context

<?php
use use Silence\Config\AppContextFactory;

$appContext = AppContextFactory::create('prod', true);
$appContext->getEnv(); // 'prod'
$appContext->isDebug(); // true
$appContext->getLocale(); // 'en_US' by default

🧱 Features:

  • Hierarchical config access
  • Escaped dots in keys
  • Dynamic value setting
  • Safe value retrieval
  • Pure-PHP, dependency-free

🧪 Testing

php vendor/bin/phpunit

🧩 Use in the composition of Silence

The package is used to access the context and parameters of the ‘Silence’ application.
If you are writing your own package, you can connect silencenjoyer/silence-config to store configuration parameters.

📄 License

This package is distributed under the MIT licence. For more details, see LICENSE.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-18