You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.5 KiB
50 lines
1.5 KiB
<?php
|
|
|
|
namespace utils;
|
|
|
|
class php_composer {
|
|
|
|
const composer_exe = "/usr/local/bin/composer";
|
|
|
|
public static function init($dir) {
|
|
chdir($dir);
|
|
exec(self::composer_exe . " init", $output, $exit_code);
|
|
check_for_error($exit_code, "PHP Composer init error");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function install($dir) {
|
|
chdir($dir);
|
|
exec(self::composer_exe . " install", $output, $exit_code);
|
|
check_for_error($exit_code, "PHP Composer init error");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function update($dir) {
|
|
chdir($dir);
|
|
exec(self::composer_exe . " update", $output, $exit_code);
|
|
check_for_error($exit_code, "PHP Composer init error");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function require($dir, $vendor) {
|
|
chdir($dir);
|
|
exec(self::composer_exe . " require " . safe_cmd($vendor), $output, $exit_code);
|
|
check_for_error($exit_code, "PHP Composer init error");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function remove($dir, $vendor) {
|
|
chdir($dir);
|
|
exec(self::composer_exe . " remove " . safe_cmd($vendor), $output, $exit_code);
|
|
check_for_error($exit_code, "PHP Composer init error");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function self_update() {
|
|
exec(self::composer_exe . " self-update", $output, $exit_code);
|
|
check_for_error($exit_code, "PHP Composer init error");
|
|
return $exit_code;
|
|
}
|
|
|
|
}
|
|
|