定制 lordmonoxide/facade 二次开发

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

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

lordmonoxide/facade

最新稳定版本:1.0.1

Composer 安装命令:

composer require lordmonoxide/facade

包简介

Pseudo-static accessors for Phi bindings

README 文档

README

Build Status Coverage Status License

Phi Facades

Facades are a way to make Phi bindings feel more natural.

Installation

Composer

Composer is the recommended method of installation for Facade.

$ composer require lordmonoxide/facade

GitHub

Facade may be downloaded from GitHub.

Features

Pseudo-Static Access To Phi Singletons

A common use-case for Phi Facades is logging:

namespace Vendor\Package\Logging;

class Logger {
  public function warning($text) {
    // ...
  }
}
$logger = new Vendor\Package\Logging\Logger;

$phi = LordMonoxide\Phi\Phi::instance();
$phi->bind('core.log', $logger);
use LordMonoxide\Facade\Facade;

class Log extends Facade {
  protected static $_binding = 'core.log';
}

Once the facade is set up, the Vendor\Package\Logging singleton can be accessed like this:

Log::warning('Something bad happened!');

Phi Facades can even be used to create a facade for Phi:

$phi = LordMonoxide\Phi\Phi::instance();
$phi->bind('phi', $phi);
use LordMonoxide\Facade\Facade;

class Phi extends Facade {
  protected static $_binding = 'phi';
}

This will allow Phi to be accessed as such:

Phi::bind('Bar', 'Foo');
$foo = Phi::make('Bar');

Phi Custom Resolvers

If you are using Phi 1.2.0 or greater, Phi facades will work seamlessly with custom resolvers.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPLv3
  • 更新时间: 2015-05-09