承接 jonsa/silex-ioc 相关项目开发

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

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

jonsa/silex-ioc

最新稳定版本:v0.2.0

Composer 安装命令:

composer require jonsa/silex-ioc

包简介

IoC for Silex application

关键字:

README 文档

README

Class resolver for the Silex application.

This project is a bridge between Pimple IoC and the Silex Application.

Installation

Add the IoC container to your composer.json using the command line.

composer require jonsa/silex-ioc

Usage

The class resolver is registered in Silex as a ServiceProvider

use Jonsa\PimpleResolver\ServiceProvider as PimpleResolverServiceProvider;
use Jonsa\SilexResolver\ServiceProvider as SilexResolverServiceProvider;
use Silex\Application;

$app = new Application();
$app->register(new PimpleResolverServiceProvider());
$app->register(new SilexResolverServiceProvider());

Events

The Silex event dispatcher is registered with PimpleResolver which makes it easy to inject into the resolver.

use Jonsa\PimpleResolver\Event\ClassResolvedEvent;
use Jonsa\PimpleResolver\Events as ResolverEvents;

$app->on(ResolverEvents::CLASS_RESOLVED, function (ClassResolvedEvent $event) {
    $object = $event->getResolvedObject();
    ...
});

Configuration

The ServiceProvider has one configuration parameter.

class ServiceProvider implements ServiceProviderInterface {
    public function __construct($resolveControllers = true)
    {
        ...
    }
}

$resolveControllers tells the ServiceProvider whether to replace the built-in controller resolver in Silex. If set to true controllers will be resolved out of the IoC container.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-28