简体   繁体   中英

PHP Deployer change Composer Version

i use PHP Deployer with bitbucket pipelines my deployment worked fine until composer version 2.0 was released. Now i need to downgrade composer to version 1 but i don't know how to set the version.

I know that i can set the PHP Version like this:

set('bin/php', 'php74 -d allow_url_fopen=On');

Hope someone can help me.

Thank you!

Simply override the bin/composer definition in your deploy.php file (originally located here: https://github.com/deployphp/deployer/blob/6.x/recipe/common.php#L114-L125 )

set('bin/composer', function() {
    if (commandExist('composer')) {
        $composer = locateBinaryPath('composer');
    }

    if (empty($composer)) {
        run("cd {{release_path}} && curl -sS https://getcomposer.org/download/1.10.17/composer.phar -o composer.phar");
        $composer = '{{bin/php}} {{release_path}}/composer.phar';
    }

    return $composer;
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM