承接 chrissileinus/config-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

chrissileinus/config-php

Composer 安装命令:

composer require chrissileinus/config-php

包简介

A storage to hold the config of an app. It ist mainly static but as a Singleton with integrated interfaces ArrayAccess, Serializable, JsonSerializable, IteratorAggregate and Traversable.

README 文档

README

A storage to hold the config of a app. It ist mainly static but as a Singleton I have integrated the interfaces ArrayAccess, Serializable, JsonSerializable, IteratorAggregate and Traversable.

Why

There was a need for a small class that is able to read the config from serval inputs and files so that it is stored in a way that it is globally accessible with serval interfaces.

Usage

Config\Storage::integrate(
  // default values
  [
    'database' => [
      'host' => "localhost",
      'port' => 3306,
      'name' => "databasename",
      'user' => "username",
      'pass' => "fdsgsdgs",
    ],
    'log' => [
      'timezone' => "UTC",
      'console' => [
        'level' => Log\Level::NONE,
        'ignore' => [],
      ]
    ]
  ],
  // default value get replaced by values from config files.
  '/etc/App/*.yaml',
  '/etc/App/*.json'
);

$dbConfig = Config\Storage::getInstance()['database'];
$db = new PDO("mysql:host={$dbConfig['host']};port={$dbConfig['port']};dbname={$dbConfig['name']}", $dbConfig['user'], $dbConfig['pass']);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固