Composer auto-update

Often every 30 days I get this warning:

Warning: This development build of composer is over 30 days old. It is recommended to update it by running "composer.phar self-update" to get the latest version. 

Then I have to re-do the update every 30 days. In any case, may I be able to automatically update the composer?

Thanks.

+11
source share
4 answers

Composer does not have a function to automatically run self-update , as far as I know. In addition, running self-update alone does not seem to be correct. Maybe you do not have permission? Then try using sudo, for example: sudo composer self-update .

This is a simple command, and you only need to execute it once every 30 days. And keep Composer installed globally so you don't have to run it for every project.

+23
source

The composer is still under development. Alpha versions have been released, but there is still no forecast date for the first stable release.

Thus, running composer self-update always sets the most recent commit from the Github repository. Expect these commits to be broken! If you can live with your automatic update to constantly install broken versions of Composer, just create a cronjob that runs once a month or more.

If you think this is too much, then update manually and see if everything works.

+1
source

Put the composer self-update command in the bash file and execute from the cron job.

This link has a good discussion and explanation of how to use cron: https://askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job

The most basic explanation would put the shell script in this folder: /etc/cron.monthly .

+1
source

try the following command.

 sudo composer self-update 

It worked for me!

-1
source

Source: https://habr.com/ru/post/972429/


All Articles