定制 dev-sanjeeb/config 二次开发

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

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

dev-sanjeeb/config

Composer 安装命令:

composer require dev-sanjeeb/config

包简介

This project is focused around writing a parser for configuration files.

README 文档

README

This project is focused around writing a parser for configuration files.

Supported file formats:

  • JSON

Requirements

  • PHP >= 7.2

Install with Composer

$ composer require dev-sanjeeb/config

Usage

Loading Files

Method 1: At the time of initialization

// Loading Single file
$config = new Config(__DIR__.'/files/test.json');

// Loading Multiple file
$config = new Config([__DIR__.'/files/test.json', __DIR__.'/files/test2.json']);

Method 2: After initialization

$config = new Config();

// Loading Single file
$config->loadFiles(__DIR__.'/files/test.json');

// Loading Multiple file
$config->loadFiles([__DIR__.'/files/test.json', __DIR__.'/files/test2.json']);

Loading Raw Text

$config = new Config();

// Loading Raw Text
$config->loadRawText(
            [
                [
                    'content' => '{"a":1,"b":2,"c":3,"d":4,"e":5}',
                    'type' => 'json'
                ],
                [
                    'content' => '{"a1":1,"b1":2,"c1":3,"d1":4,"e1":5}',
                    'type' => 'json'
                ]
            ]
        );

Getter

$config = new Config();

// Accessing 
$config->get('database.host');

// Accessing with default data
$config->get('database.host', '127.0.0.1');

Setter

$config = new Config();

// Setting value
$config->set('database.host', '127.0.0.1');

Merge Array

$config = new Config();

// merge value
$config->merge(['database' => ['host'] => '127.0.0.1']);

Reset

$config = new Config();

// Resetting value
$config->reset();

Testing

$ phpunit

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固