承接 icanboogie/config 相关项目开发

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

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

icanboogie/config

最新稳定版本:v1.3.0

Composer 安装命令:

composer require icanboogie/config

包简介

Synthesizes low-level configurations.

关键字:

README 文档

README

Release Code Coverage Downloads

An API to build low-level configuration.

This package is used by the framework ICanBoogie to configure its components.

Configurations are defined by a set of files called fragments. Builders use these fragments to build configurations. Configurations are managed by a [Config][] instance. Configurations can be cached, which cancels the cost of the builds.

Installation

composer require icanboogie/config

Configuration fragments

A configuration fragment is a PHP file returning a callable. Multiple fragments are used to build a configuration. They're usually located in "config" directories and are usually named after the config they are used to build.

Configuration provider

Configurations are read through a ConfigProvider.

The following example demonstrates how to get a configuration of class MyConfig:

<?php

/* @var \ICanBoogie\ConfigProvider\BasicConfigProvider $config */

$my_config = $config->config_for_class(MyConfig::class);

A NoBuilderDefined exception is thrown if there is no builder defined for a configuration class.

Configuration builders

Builders are defined for each configuration.

<?php

use ICanBoogie\ConfigProvider\BasicConfigProvider;

/* @var string[] $paths */

$builders = [ MyConfig::class => MyBuilder::class ];
$config = new BasicConfigProvider($paths, builders);
$my_config = $config->config_for_class(MyConfig::class);

Caching configurations

Caching configurations removes the cost of building by reusing the result of a previous build. To enable caching, you just need to provide a cache implementing Storage.

<?php

namespace ICanBoogie;

use ICanBoogie\ConfigProvider\BasicConfigProvider;

$config = new BasicConfigProvider($paths, $builders, $cache);

Continuous Integration

The project is continuously tested by GitHub actions.

Tests Static Analysis Code Style

Code of Conduct

This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you're expected to uphold this code.

Contributing

Please see CONTRIBUTING for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-01-13