定制 mattjmattj/manioc 二次开发

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

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

mattjmattj/manioc

最新稳定版本:1.0

Composer 安装命令:

composer require mattjmattj/manioc

包简介

An IoC container based on Maybe and Pimple

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage

An IoC container based on Maybe and Pimple. Manioc actually directly depends on Pimple 3 and extends it with Maybe.

Installation

with composer

composer.phar require mattjmattj/manioc ~1.0

Basic usage

use Manioc\Container;
[...]

$container = new Container();

// A Manioc container is a Pimple 3 container
$container['feature.foo.enabled'] = false;

$container['Cache'] = function($c) {
	new Cache();
}

// ...but with Maybe! Here we use a feature switch to build an instance of Foo
// and wrap it with Maybe. If feature.foo is disabled, Maybe will provide a fake
// object
$container['Foo'] = $container->maybe('Foo',function($c) {
	if ($c['feature.foo.enabled']) {
		return new Foo();
	}
});

// we can also register factories:
$container['Foo'] = $container->maybeFactory('Foo',function($c) {
	if ($c['feature.foo.enabled']) {
		return new Foo();
	}
});

License

Manioc is licensed under BSD-2-Clause license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2015-03-21