Install Composer system-wide packages
Composer can have packages installed system-wide, such as the infinitely useful and should be included in core already, Prestissimo which greatly speeds up install and updates of other packages.
NB: This appears not to work. Can symlink a user's ~/.composer to the directory to share things, but it doesn't work entirely brilliantly.
The system wide composer.json and vendor directories are located in /opt/composer.
First step is to create the above directory, as it does not exist by default. Then add/create your composer.json file, either manually, or by using composer init.
composer.json:
{ "name": "root/system-composer-utils", "description": "System wide composer tools available to all users", "type": "project", "license": "GPL-2.0-or-later", "authors": [ { "name": "Ted", "role": "SuperUser" } ], "require": { "hirak/prestissimo": "^0.3.9" } }
Once that's created, it just needs to be installed.
cd /opt/composer && composer install --no-dev
Updating the packages later is just a case of running
cd /opt/composer && composer update --with-dependencies --no-dev