frizinak/drupony

安装: 154

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:drupal-module

0.2.1 2017-06-06 12:59 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:39:03 UTC


README

Build Status

目前:一个微型的drupal-symfony-dependency-injection包装器。

期望:

  • hook_menu > symfony路由和控制器
  • node / taxonomy_terms / user > 实体
  • ...
  • 始终作为一个提供SDK的模块存在。

安装

将以下内容添加到您的项目composer.json文件中

"require":{
  ...
  "frizinak/drupony": "?.?.?"
}
"extra": {
  "installer-paths": {
    "<path to your modules dir>/drupony": ["frizinak/drupony"]
  }
}

<您的模块目录路径>相对于您的composer.json文件。

  • 如果您的composer.json位于DRUPAL_ROOT,则为sites/www.example.com/modules/contrib
  • 如果您的composer.json位于DRUPAL_ROOT/sites且不使用contrib/custom子目录,则为all/modules
  • 只要它相对于您的composer.json,并且Drupal可以将其识别为模块,则为anywhere/anywhere

$ composer update (-o --no-dev)

配置

  • 变量(及其默认值)
$conf['drupony_debug'] = FALSE;         // Only enable in dev env (e.a. staging.settings.php)
$conf['drupony_error_handler'] = TRUE;  // Symfony error handler will only be enabled
                                        // if both drupony_debug and drupony_error_handler are truthy.
$conf['drupony_autoloader'] = ?;        // Absolute path to composer autoload.php (optional), will be set if
                                        // it could be found automatically.

API

$drupony = drupony_get_wrapper()::Drupony\\Drupony

          // Symfony ContainerBuilder
$drupony->getContainer()  // Any service declared in enabledModule/service.yml
                        ->get('symfony.component.filesystem')
                        ->mkdir('woop');

定义一个服务:yourModule/parameters.yml(或hook_drupony_parameters)

parameters:
 yourModule.yourService.class: YourModule\YourServiceClass

yourModule/services.yml(或hook_drupony_services)

services:
 yourModule.yourService:
   class: %yourModule.yourService.class%

贡献

请这么做。