简体   繁体   中英

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

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

There are two approaches to solving your problem, Option A

  • as was stated, go to your composer.json and update the line
  • go to Terminal at the cpanel, should you not have terminal, use option 2
  • cd into your directory and run php composer update, (please before doing this, make sure to have a copy of your composer.json and the lock files.

Option B (No Terminal at cpanel)

  • Zip your directory and download
  • copy the file after unzipping to your wamp/xamp directory
  • edit the composer.json
  • and run php composer update (things can break here, I think the best is to run composer install rather than update)
  • zip and upload the file back.

I believe that should solve the problem

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