0.4.5 • Published 6 years ago

gulp-composer v0.4.5

Weekly downloads
1,300
License
MIT
Repository
github
Last release
6 years ago

gulp-composer

Install composer packages from within gulp, even without composer itself installed on the system.

Install

npm i gulp-composer --save-dev

Requirements

Recommended

Part of the magic of gulp-composer is that having composer installed on the system is not required! However, it is still recommended as it will increase performance of the task.

  • By default, gulp-composer will search for composer in {working-dir}/composer.phar. If it's not found, it will attempt to use the globally installed composer command.
  • If composer(.phar) is still not found on the system, it will attempt to download it to the system temp directory. Future builds will check the system temp directory so it doesn't download it too often.

Usage

composer = require('gulp-composer');
composer([ command, ] [ options ]);

Parameters

ParameterDefaultDescription
command StringinstallThe composer command to execute. See composer --help for list of available commands
options Objectsee optionsAll options for gulp-composer and native composer

Options

OptionDefaultDescriptionPassed to composer
bin StringautoPath to the composer binary. E.g. composer, /usr/bin/composer.phar, or php /path/to/composer.No
self-install BooleantrueSet to false to disable self-install.No
async BooleantrueBy default, the composer bin will load asynchronously. Use false to run it synchronously.No
ansi BooleantrueThe default for this parameter is automatically passed composer to enable logging in color.Yes
working-dir StringcwdThe path with which to run composer against (normally where the composer.json is located).Yes
...mixedAny other arguments will be passed through to composerYes

Examples

Most basic setup:

var composer = require("gulp-composer");

gulp.task("composer", function () {
	composer();
});

Most basic setup with self-install disabled:

var composer = require("gulp-composer");

gulp.task("composer", function () {
	composer({ "self-install": false });
});

Adding a few options:

var composer = require("gulp-composer");

gulp.task("composer", function () {
	composer({
		"working-dir": "./php-stuff",
		bin: "composer"
	});
});

A more complex setup:

var composer = require("gulp-composer"),
	gutils = require("gulp-utilities");

// ...

composer("init", { "no-interaction": true });
composer('require "codeception/codeception:*"', {});

if (gutils.env.production) {
	composer({
		"bin":          "/build/share/composer.phar",
		"no-ansi":      true,
		"self-install": false,
	});
} else {
	//default install
	composer();
}

composer("dumpautoload", {optimize: true});

Contributors