mouf/nodejs-installer
Composer 安装命令:
composer require mouf/nodejs-installer
包简介
An installer package that let's you install NodeJS and NPM as a Composer dependency.
关键字:
README 文档
README
NodeJS installer for Composer
This is an installer that will download NodeJS and NPM and install them in your Composer dependencies. Installation is skipped if NodeJS is already available on your machine.
Why?
NodeJS is increasingly becoming a part of the tool-chain of modern web developers. Tools like Bower, Grunt, Gulp... are used everyday to build applications. For the PHP developer, this means PHP projects have build dependencies on NodeJS or Bower / NPM packages. The NodeJS-installer attempts to bridge the gap between NodeJS and PHP by making NodeJS easily installable as a Composer dependency.
Building on this package, other packages like koala-framework/composer-extra-assets can be used to automatically fetch Bower / NPM packages, run Gulp / Grunt tasks, etc...
How does it work?
Simply include this package in your composer.json requirements:
{
"require": {
"mouf/nodejs-installer": "~1.0"
}
}
By default, if NodeJS is not available on your computer, it will be downloaded and installed in vendor/nodejs/nodejs.
You should access NodeJS and NPM using the scripts created into the vendor/bin directory:
- vendor/bin/node (vendor/bin/node.bat on Windows)
- vendor/bin/npm (vendor/bin/npm.bat on Windows)
Options
A number of options are available to customize NodeJS installation:
{
"require": {
"mouf/nodejs-installer": "~1.0"
},
"extra": {
"mouf": {
"nodejs": {
"version": "~0.12",
"targetDir": "vendor/nodejs/nodejs",
"forceLocal": false
}
}
}
}
Available options:
- version: This is the version number of NodeJS that will be downloaded and installed.
You can specify version constraints in the usual Composer format (for instance "~0.12" or ">0.11").
Default value: * The latest stable version of NodeJS is installed by default. - targetDir: The target directory NodeJS will be installed in. Relative to project root.
This option is only available in the root package.
Default value: vendor/nodejs/nodejs - forceLocal (boolean): If set to true, NodeJS will always be downloaded and installed locally, even if NodeJS
is already available on your computer.
This option is only available in the root package.
Default value: false - includeBinInPath (boolean): After the plugin is run in Composer, the vendor/bin directory can optionally be
added to the PATH. This is useful if other plugins rely on "node" or "npm" being available globally on the
computer. Using this option, these other plugins will automatically find the node/npm version that has been
downloaded. Please note that the PATH is only set for the duration of the Composer script. Your global environment
is not impacted by this option.
This option is only available in the root package.
Default value: false
Custom script
The installer listens to the following composer scripts to be launched:
{
"post-install-cmd": {
// ...
},
"post-update-cmd": {
// ...
}
}
If you need to launch the installer manually, you can run the following command:
$ composer run-script download-nodejs
mouf/nodejs-installer 适用场景与选型建议
mouf/nodejs-installer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 709.58k 次下载、GitHub Stars 达 107, 最近一次更新时间为 2015 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nodejs」 「installer」 「npm」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mouf/nodejs-installer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mouf/nodejs-installer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mouf/nodejs-installer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
DNode RPC protocol for PHP 5.3
A simple Composer script to install NPM and/or Bower dependencies
Installs Node.js, NPM, and Yarn into vendor/bin
Installs Aura packages to the Aura system "package" directory.
Send events to a websocket real time engine though PHP
Install WordPress must-use plugins with Composer
统计信息
- 总下载量: 709.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 113
- 点击次数: 38
- 依赖项目数: 14
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-09