承接 janschumann/dic 相关项目开发

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

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

janschumann/dic

最新稳定版本:1.1.0

Composer 安装命令:

composer require janschumann/dic

包简介

Integrates Symfony´s dependency injection container with drupal.

关键字:

README 文档

README

Build Status

Overview

Integrates the Symfony´s Dependency Injection Container with drupal.

Installation

This project can be checked out with composer.

{
  "require": {
    "janschumann/dic": "*"
  }
}

Confguration

Usually no configuration is necessary.

The default dic cache dir will be determined by DRUPAL_ROOT . '/' . variable_get('file_public_path', '') . '/dic'.

This can be customized by setting the dic_root_dir variable.

Via shell script:

$ drush vset dic_root_dir <path/to/cache/dir>

Via php:

variable_set('dic_root_dir', '<path/to/cache/dir>');

Usage

Class autoloading is done via composer using the composer_classloader module.

By default a settings.xml or an environment specific derivate (settings_<environment>.xml) is loaded.

Provided services

This module provides the symfony event dispacher as a service available through the container.

An instance of the event dispacher can be retrieved by

$dispatcher = drupal_dic()->get('event_dispatcher');

To add a listener to an event, add te following to your settings.xml file.

<service id="my_service" class="%my_service.class%">
  <tag name="drupal.event_listener" event="<my_event_name>" method="<method_on_my_service>" />
</service>

An event is dispached by:

drupal_dic()->get('event_dispatcher')->dispatch('<my_event_name>', <the event class>);

Register bundles

Your modules may implement hook_dic_bundle_info() as described in dic.api.php to register their bundles.

Example:

/**
 * Implements @see hook_dic_bundle_info()
 */
function <my_module>_dic_bundle_info() {
  return array('bundles' => array("\\MyNamespace\\MyBundle\\Bundle\\MyBundle\\MyBundle"));
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-29