定制 tinyapps/yaml-config 二次开发

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

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

tinyapps/yaml-config

Composer 安装命令:

composer require tinyapps/yaml-config

包简介

Simple PHP library for using yaml config files

README 文档

README

Unit Tests

YAML Config

Simple PHP library for conveniently using yaml config files and (optional) loading into environment variables.

Requirements

PHP ^8.0 or ^8.1 and php-yaml extension (v1.2.0 is based on symfony/yaml instead)

You can use v1.0.2 or lower for PHP 7.4 compatibility (requires the php-yaml extension though).

Installation

composer require tinyapps/yaml-config

Usage

Config

$config = new \TinyApps\YamlConfig\Config(__DIR__ . '/config.yml');

var_dump($config->get('your_variable')); // or
var_dump($config['your_variable']); // or
var_dump($config->your_variable);

// You can also set the config directory once for easier access
\TinyApps\YamlConfig\Config::setConfigDir(__DIR__ . '/example-configs');

$config = new Config('example'); // will read example-configs/example.yml
$config = new Config('sub/test'); // will read example-configs/sub/test.yml

Load into environment variables

TinyApps\YamlConfig\EnvLoader::init(__DIR__ . '/env.yml');
var_dump(getenv('your_environment_variable'));

Get a single value from a config (static context)

TinyApps\YamlConfig\Config::getConfigValue('example', 'property'); // returns the "property" value from example config

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固