PHPackages                             mouf/nodejs-installer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mouf/nodejs-installer

ActiveComposer-plugin

mouf/nodejs-installer
=====================

An installer package that let's you install NodeJS and NPM as a Composer dependency.

v1.0.14(5y ago)113692.7k↓16.5%28[3 PRs](https://github.com/thecodingmachine/nodejs-installer/pulls)14MITPHPPHP &gt;=5.3.0

Since Mar 11Pushed 3y ago15 watchersCompare

[ Source](https://github.com/thecodingmachine/nodejs-installer)[ Packagist](https://packagist.org/packages/mouf/nodejs-installer)[ Docs](http://mouf-php.com/packages/mouf/nodejs-installer)[ RSS](/packages/mouf-nodejs-installer/feed)WikiDiscussions 1.0 Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (17)Used By (14)

[![Latest Stable Version](https://camo.githubusercontent.com/d6fd4aed761bd4f2010577fa6ba6d19b9e3af6f9bebf1bbbe4884a242f65309c/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f6e6f64656a732d696e7374616c6c65722f762f737461626c652e737667)](https://packagist.org/packages/mouf/nodejs-installer)[![Latest Unstable Version](https://camo.githubusercontent.com/084e0c00b4856d54b2a1861a6478ea55e4db30c60f813d60acaa08c5c43f01e4/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f6e6f64656a732d696e7374616c6c65722f762f756e737461626c652e737667)](https://packagist.org/packages/mouf/nodejs-installer)[![License](https://camo.githubusercontent.com/f216d5892d8eaaefb3cf1aaf8fcfa920a8e1748209ef16dd63c7a4e96239958c/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f6e6f64656a732d696e7374616c6c65722f6c6963656e73652e737667)](https://packagist.org/packages/mouf/nodejs-installer)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e20802dd2139600b07e9adc7d47a54d46d38e0035c168961c2f4cfd3a9281bbc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746865636f64696e676d616368696e652f6e6f64656a732d696e7374616c6c65722f6261646765732f7175616c6974792d73636f72652e706e673f623d312e30)](https://scrutinizer-ci.com/g/thecodingmachine/nodejs-installer/?branch=1.0)

NodeJS installer for Composer
=============================

[](#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?
----

[](#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](https://github.com/koala-framework/composer-extra-assets)can be used to automatically fetch Bower / NPM packages, run Gulp / Grunt tasks, etc...

How does it work?
-----------------

[](#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
-------

[](#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 "&gt;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
-------------

[](#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

```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity53

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 82.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~128 days

Recently: every ~372 days

Total

17

Last Release

2022d ago

Major Versions

v0.1.0 → v1.0.02015-03-12

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1104771?v=4)[mouf](/maintainers/mouf)[@Mouf](https://github.com/Mouf)

---

Top Contributors

[![moufmouf](https://avatars.githubusercontent.com/u/1290952?v=4)](https://github.com/moufmouf "moufmouf (52 commits)")[![nsams](https://avatars.githubusercontent.com/u/50764?v=4)](https://github.com/nsams "nsams (2 commits)")[![delmicio](https://avatars.githubusercontent.com/u/2908209?v=4)](https://github.com/delmicio "delmicio (1 commits)")[![itmo-urir](https://avatars.githubusercontent.com/u/62056763?v=4)](https://github.com/itmo-urir "itmo-urir (1 commits)")[![kaufmo](https://avatars.githubusercontent.com/u/1416828?v=4)](https://github.com/kaufmo "kaufmo (1 commits)")[![merwan](https://avatars.githubusercontent.com/u/222879?v=4)](https://github.com/merwan "merwan (1 commits)")[![PedroTroller](https://avatars.githubusercontent.com/u/1766827?v=4)](https://github.com/PedroTroller "PedroTroller (1 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (1 commits)")[![acrollet](https://avatars.githubusercontent.com/u/101649?v=4)](https://github.com/acrollet "acrollet (1 commits)")[![xhuberty](https://avatars.githubusercontent.com/u/8350192?v=4)](https://github.com/xhuberty "xhuberty (1 commits)")[![dbu](https://avatars.githubusercontent.com/u/76576?v=4)](https://github.com/dbu "dbu (1 commits)")

---

Tags

installernodejsnpm

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mouf-nodejs-installer/health.svg)

```
[![Health](https://phpackages.com/badges/mouf-nodejs-installer/health.svg)](https://phpackages.com/packages/mouf-nodejs-installer)
```

###  Alternatives

[composer/installers

A multi-framework Composer library installer

1.4k136.0M6.0k](/packages/composer-installers)[fxp/composer-asset-plugin

NPM/Bower Dependency Manager for Composer

8894.8M41](/packages/fxp-composer-asset-plugin)[dealerdirect/phpcodesniffer-composer-installer

PHP\_CodeSniffer Standards Composer Installer Plugin

598161.9M1.9k](/packages/dealerdirect-phpcodesniffer-composer-installer)[foxy/foxy

Fast, reliable, and secure NPM/Yarn/pnpm bridge for Composer

177287.5k25](/packages/foxy-foxy)[typo3/cms-composer-installers

TYPO3 CMS Installers

6113.7M52](/packages/typo3-cms-composer-installers)[php-forge/foxy

Fast, reliable, and secure Bun/NPM/Yarn/pnpm bridge for Composer

45103.3k4](/packages/php-forge-foxy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
