定制 drush/example-drush-extension 二次开发

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

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

drush/example-drush-extension

Composer 安装命令:

composer require drush/example-drush-extension

包简介

Example Drush site-wide extension

README 文档

README

Build Status

This is an example Drush extension that is compatible with both Drush 9.6+ and Drush 8.2+. It includes tests that run on both versions of Drush.

This this project demonstrates what is known as a "site-wide" Drush extension. Site-wide extensions are installed via Composer into a particular Drupal site. The other kinds of Drush extensions are Drush module commands and Drush global commands. See the Creating Custom Drush Commands documentation for more information.

For maximum compatibility with future versions of Drush, a site-wide Drush extension should only call the following APIs:

  • APIs provided by Drupal
  • APIs provided by Drupal's dependencies
  • Libraries decleared in the site-wide extension's own composer.json file

Avoid using Drush APIs, save for those that are defined by your command's base class, DrushCommands, or those that are provided by objects injected into your command class by Drush. See ExampleCommands.php for examples.

Usage

In development, clone this repository, then set up the System Under Test (sut) via:

composer install
composer drupal:scaffold

That will set up your local project to run and test with Drush 9. To use Drush 8 instead:

composer scenario drush8

The Composer Test Scenarios project is used to manage the Composer dependencies needed to test different scenarios of this project. Running composer scenario is like running composer install; it will install the appropriate dependencies for the requested testing scenario. Run composer install to return to the default installation.

To use this extension in production (that is, to install it in a Drupal 8 site):

cd /path/to/my-drupal-composer-drupal-project
composer require drush/example-drush-extension

Running Tests

Set up for 'development' as described in usage section. Then, run:

composer test

Ad-hoc Testing

In development:

composer drush example:param test

In production:

cd /path/to/my-drupal-composer-drupal-project
drush example:param test

Customizing

  1. Fork this repository.
  2. Alter "name", "description" and etc. in composer.json to suit.
  3. Rename ExampleCommands.php and ExampleCommandsTest.php for your project.
  4. Configuration and site aliases for use in testing can be placed in 'sut/drush/drush.yml' and 'sut/drush/sites/self.site.yml', respectively.
  5. Examine 'sut/drush/drush.yml' and 'sut/drush/drushrc.php', and alter the names of the example command files to match the names in your project. This is necessary for Drush to be able to find your command files when running tests or doing ad-hoc testing, as usually, command files are searched for in the parent directory of the project root.
  6. Add your extension on packagist.org so that it may be installed via Composer.

drush/example-drush-extension 适用场景与选型建议

drush/example-drush-extension 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 57 次下载、GitHub Stars 达 8, 最近一次更新时间为 2019 年 03 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 drush/example-drush-extension 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 drush/example-drush-extension 我们能提供哪些服务?
定制开发 / 二次开发

基于 drush/example-drush-extension 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2019-03-13