定制 eloquent/composer-npm-bridge 二次开发

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

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

eloquent/composer-npm-bridge

最新稳定版本:5.0.1

Composer 安装命令:

composer require eloquent/composer-npm-bridge

包简介

NPM integration for Composer packages.

README 文档

README

No longer maintained

This package is no longer maintained. See this statement for more info.

Composer NPM bridge

NPM integration for Composer packages.

Current version image Current build status image Current coverage status image

Installation

Requirements

  • The npm executable must be available in PATH.

Usage

To utilize the Composer NPM bridge, simply add eloquent/composer-npm-bridge to the require section of the project's Composer configuration:

composer require eloquent/composer-npm-bridge

NPM dependencies are specified via a package.json configuration file in the root directory of the Composer package. Source control should be configured to ignore NPM's node_modules directory, similar to Composer's vendor directory.

How does it work?

The Composer NPM bridge is a Composer plugin that automatically installs and updates NPM packages whenever the corresponding Composer command is executed. To detect compatible packages, the bridge inspects Composer package configuration information to find packages that directly require the eloquent/composer-npm-bridge Composer package itself.

In addition to normal operation, composer install will install NPM dependencies for all Composer packages using the bridge. This includes the root package, as well as Composer dependencies. Similarly, composer update will install NPM dependencies for all Composer dependencies using the bridge. It will also update the NPM dependencies for the root project.

NPM dependencies will be installed exactly as if npm install were run from the root directory of the package. This applies even if the package is installed as a dependency.

Configuration

The following configuration can be added to composer.json under the extra.npm-bridge section to customize the behavior on a per-package basis. Values in the root package will not currently impact any dependency packages that also use Composer NPM bridge - each package must define its own options.

Key Type Default Description
timeout int 300 Specify a custom timeout for the installation (in seconds).
optional bool false Skip instead of throwing an exception if npm is not found when processing the package.
{
    // ...

    "extra": {
        "npm-bridge": {
            "timeout": 9000,
            "optional": true
        },

        // ...
    }
}

Composer NPM bridge can be completely disabled by setting the COMPOSER_NPM_BRIDGE_DISABLE environment variable to a non-empty value:

COMPOSER_NPM_BRIDGE_DISABLE=1 composer install

Caveats

Because NPM dependencies are installed underneath the root directory of the Composer package, Composer may complain about working copy changes when the package is installed as a dependency. Source control should be configured to ignore the node_modules directory in order to avoid this.

eloquent/composer-npm-bridge 适用场景与选型建议

eloquent/composer-npm-bridge 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 849.54k 次下载、GitHub Stars 达 81, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「package」 「plugin」 「composer」 「Bridge」 「npm」 「integration」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 eloquent/composer-npm-bridge 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 849.54k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 87
  • 点击次数: 23
  • 依赖项目数: 18
  • 推荐数: 0

GitHub 信息

  • Stars: 81
  • Watchers: 5
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 未知