Skip to content

Marketera/gulp-composer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Parameter Default Description
command
String
install The composer command to execute. See composer --help for list of available commands
options
Object
see options All options for gulp-composer and native composer

Options

Option Default Description Passed to composer
bin
String
auto Path to the composer binary. E.g. composer, /usr/bin/composer.phar, or php /path/to/composer. No
self-install
Boolean
true Set to false to disable self-install. No
async
Boolean
true By default, the composer bin will load asynchronously. Use false to run it synchronously. No
ansi
Boolean
true The default for this parameter is automatically passed composer to enable logging in color. Yes
working-dir
String
cwd The path with which to run composer against (normally where the composer.json is located). Yes
... mixed Any other arguments will be passed through to composer Yes

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

About

gulp plugin to install composer files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%