Search code examples
phplaravelcomposer-phprecurly

how shall I run a composer update command


I am trying to ask the question as precisely as possible but I myself have lots of confusion about this. So please bear with me

Problem - We have a third party API (Recurly) installed in our site. That site was built with Laravel. The version of that API is now outdated and I want to update the version via composer.

From the Recurly I have got the following instruction to upgrade the version

In composer.json file update the line of code from "recurly/recurly-client": "2.8." to "recurly/recurly-client": "2.12. . And this will upgrade your client library AND your API version. Once you do this, please run a composer update in your terminal->active directory w/ Recurly and it will update you:

I have updated the line inside composer.json file. But I dont understand the second part of the instruction. How to run a composer update. Shall I update the composer itself? But I want to update the Recurly API version. is it necessary to update the composer itself?

I have found this link: https://getcomposer.org/doc/03-cli.md#update-u

In this link its written

In order to get the latest versions of the dependencies and to update the composer.lock file, you should use the update command. This command is also aliased as upgrade as it does the same as upgrade does if you are thinking of apt-get or similar package managers.

php composer.phar update

I am not sure Is this the command I need?

Our webserver is with AWS. And we have WHM and cPanel installed to manage the web server.

I understand my question is not not precise as expected . but I cant figure out where to start actually. Please suggest me accordingly


Solution

  • As composer update command can create additional problem to the server hence i have run composer update only for Recurly as a root

    composer update recurly/recurly-client
    

    It is important to run the command from the directory where the composer.lock and composer.json files are

    for an example if you have several sites under your server and if you run the command as root it may affect other sites as well.

    To prevent that first you have to run

    cd /home/websitefolder
    

    then

    composer update recurly/recurly-client
    

    This way you can update only single package and it will not affect the rest of your site