ofcold/configuration 问题修复 & 功能扩展

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

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

ofcold/configuration

Composer 安装命令:

composer require ofcold/configuration

包简介

Configuration item supports laravel extension.

README 文档

README

Configuration item supports laravel extension.


Simplified Chinese Documentation


Features

  • Support component configuration, configuration files can be anywhere.
  • Overlay configuration, flexible.

Environment

php >= 7.1 Laravel >= 5.1

Installing

    composer require ofcold/configuration

Instructions

We may use such a scenario, in the development of Laravel components, need some configuration, or multiple configuration items. The original Laravel may require you to merge configurations and publish to the root directory. As the number of components increases, so does the config file.

Useing

use Ofcold\Configuration\LoaderConfiguration;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Config\Repository;

$loader = new LoaderConfiguration(
	$config = new Repository,
	new Filesystem
);

$loader->addNamespace('test', __DIR__ . '/tests/config');

print_r(json_encode($config->all()));
// print_r($config->get('test::test.foo') . "\r\n");

$loader->addNamespaceOverrides('test', __DIR__ . '/tests/overrides');

print_r(json_encode($config->all()));
// print_r($config->get('test::test.foo')  . "\r\n");

Results:

{
	"test::test":{
		"foo":"example"
	}
}

{
	"test::test":{
		"foo":"overrides"
	}
}

Larvel

use Ofcold\Configuration\LoaderConfiguration;

class Foo
{
	/**
	 * Create an a new Foo instance.
	 *
	 * @param LoaderConfiguration $loader
	 */
	public function __construct(LoaderConfiguration $loader)
	{
		$loader->addNamespace('test', '/config');
	}
}

OR test file.

    php test

Api

  • addNamespace(?string $namespace = null, string $directory) : void
  • addNamespaceOverrides($namespace, $directory) : void

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-06-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固