hussainweb/drupal-composer-helper
Composer 安装命令:
composer require hussainweb/drupal-composer-helper
包简介
Common scripts used with Drupal
关键字:
README 文档
README
This plugin handles common operations for composer based Drupal setups. The code in this plugin is derived from the Drupal code base itself and also other projects such as drupal-composer/drupal-project.
Why?
The motive behind writing this plugin was to make a Drupal composer based setup more maintainable. It is easy to start with the template provided by drupal-composer/drupal-project but upgrading it is difficult. The plugin solves that problem by keeping all the code outside your project and in the plugin which would make upgrading as easy as running composer update.
Installation
If you are starting off a new Drupal 7 or 8 website, it is easier to start with the hussainweb/drupal-composer-init composer plugin. Follow the instructions there to install and use the command. The composer.json files generated include this plugin.
For existing composer setups, just run this command:
composer require hussainweb/drupal-composer-helper:^1.0
Usage with the new composer template
TODO
Usage in drupal-composer template
This plugin includes most of the functionality from drupal-composer template. That said, the plugin can be used in the template with some changes. The changes are not necessary to run the plugin but some operations could run twice.
Follow these steps to use the plugin in drupal-composer template:
- Include the plugin:
composer require hussainweb/drupal-composer-helper:~1.0 - Remove
'DrupalProject\\composer\\ScriptHandler::createRequiredFiles'frompost-install-cmdandpost-update-cmdinscriptssection of your composer.json. The plugin creates all necessary files. - (Optional) After the above changes, you may remove
scripts/composer/ScriptHandler.phpfile entirely (if you have not made any changes) and remove any references from the composer.json. There are some references in theautoloadsection, and also inpre-install-cmdandpost-install-cmdscripts. This functionality is not present in the plugin but it is not really necessary as it is just a version check for composer. - (Optional) If you have not changed any paths in
installer-pathssection fromextrasection in yourcomposer.json, you may remove them. The plugin sets defaults which match the defaults set by the template. The paths in this section will take precedence over the plugin defaults.
Configuration
The plugin provides following configuration options (and defaults) in composer.json file:
{
...
"extra": {
"drupal-composer-helper": {
"set-d7-paths": false
},
...
},
...
Drupal Path
This plugin finds the path to Drupal installation using the new setting provided by the new core Drupal scaffold plugin. It uses this as a prefix to set all the Drupal relevant installer paths so that Drupal core, modules, and themes may be installed in the correct location. The plugin also runs scaffolding within this directory and creates other required files for Drupal.
Example:
{
...
"extra": {
"drupal-scaffold": {
"locations: {
"web-root": "web/"
}
},
"drupal-composer-helper": {
"additional-cleanup": [],
"set-d7-paths": false
},
...
},
...
For a Drupal 8 setup, the defaults set by this plugin are as follows:
'core': 'web/core/',
'module': 'web/modules/contrib/{$name}/',
'theme': 'web/themes/contrib/{$name}/',
'library': 'web/libraries/{$name}/',
'profile': 'web/profiles/contrib/{$name}/',
'drush': 'drush/{$name}/',
'custom-theme': 'web/themes/custom/{$name}/',
'custom-module': 'web/modules/custom/{$name}/',
The above are just defaults and can be overridden by the usual installer-paths property in extra section in your composer.json file.
drupal-web-dir (deprecated)
Default: 'web'
This setting is deprecated in favour of core's Drupal scaffold plugin settings setting. The plugin still falls back to this setting if that is not set but for compatibility with the rest of the Drupal ecosystem, it is a good idea to use the new setting.
web-prefix (deprecated)
Default: 'web'
This setting is deprecated in favour of core's Drupal scaffold plugin settings setting. The plugin still falls back to this setting if that is not set but for compatibility with the rest of the Drupal ecosystem, it is a good idea to use the new setting.
See also: set-d7-paths.
additional-cleanup (removed)
Default: Empty array
This has been replaced by the functionality in drupal/core-vendor-hardening. You still need to explicitly require that plugin in your composer.json. The plugin only suggests adding it.
set-d7-paths
Default: false
Set this to true if you are building a Drupal 7 based site. This configuration option changes the default installer-paths paths to Drupal 7 typical paths.
If your web-prefix is docroot, the installer-paths set if this option is true are as follows.
'core': 'docroot/',
'module': 'docroot/sites/all/modules/contrib/{$name}/',
'theme': 'docroot/sites/all/themes/contrib/{$name}/',
'library': 'docroot/sites/all/libraries/{$name}/',
'profile': 'docroot/sites/all/profiles/contrib/{$name}/',
'drush': 'drush/{$name}/',
'custom-theme': 'docroot/sites/all/themes/custom/{$name}/',
'custom-module': 'docroot/sites/all/modules/custom/{$name}/',
Contributing
Contributions are welcome. Please use the issue queue to describe the problem. Pull requests are welcome.
hussainweb/drupal-composer-helper 适用场景与选型建议
hussainweb/drupal-composer-helper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 103.62k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2017 年 10 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「drupal」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hussainweb/drupal-composer-helper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hussainweb/drupal-composer-helper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hussainweb/drupal-composer-helper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Provides an add-on purchasable entity.
Drupal integration module for the Kalastatic prototyping and styleguide tool
Provides a base set of configuration and module dependencies for starting new Drupal projects.
This module extends Drupal Migrate framework.
Installs and configures the WissKI base environment with mandatory modules.
Tiny set of PHP text utility classes.
统计信息
- 总下载量: 103.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 5
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-08