Commit 1153b6db authored by Nicolas Widart's avatar Nicolas Widart

add a composer helper to install

parent 1fdaba60
<?php namespace Modules\Core\Services;
class Composer extends \Illuminate\Foundation\Composer
{
protected $outputHandler = null;
private $output;
/**
* Enable real time output of all commands.
*
* @param $handler
* @return void
*/
public function enableOutput($handler)
{
$this->output = $handler;
}
/**
* Disable real time output of all commands.
*
* @return void
*/
public function disableOutput()
{
$this->output = null;
}
/**
* Update all composer packages.
*
* @param string $package
* @return void
*/
public function update($package = null)
{
if (!is_null($package)) {
$package = '"' . $package . '"';
}
$process = $this->getProcess();
$process->setCommandLine(trim($this->findComposer() . ' update ' . $package));
$process->run($this->output);
}
/**
* Require a new composer package.
*
* @param string $package
* @return void
*/
public function install($package)
{
if (!is_null($package)) {
$package = '"' . $package . '"';
}
$process = $this->getProcess();
$process->setCommandLine(trim($this->findComposer() . ' require ' . $package));
$process->run($this->output);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment