Composer is an essential utility for PHP programmers, and allows you to manage dependencies.
Dependencies
You can use your regular account to install composer, use it, and even update it. You do need to have a few packages installed first though:
sudo apt-get install git curl php-cli
Or on Fedora:
sudo dnf install git curl php-cli
Local install
Next, fetch the installer and deploy composer to your home directory
curl https://getcomposer.org/installer > composer-setup.php
mkdir -p ~/.local/bin
php composer-setup.php --install-dir=$HOME/.local/bin --filename=composer
rm composer-setup.php
Last, add ~/.local/bin to your $PATH:
echo 'PATH=$PATH:~/.local/bin' >> ~/.bashrc
source ~/.bashrc
echo $PATH
You can now run composer:
$ composer --help
Usage:
help [options] [--] []
...
$ composer self-update
You are already using composer version 1.5.6 (stable channel).
Make Composer available for all users
Just run this line if you decide that all users should have access to your copy of Composer:
sudo mv ~/.local/bin/composer /usr/local/bin/composer
If you look up a how to install Composer, you will find a tempting one-liner that uses curl to fetch a script from the Composer website, then executes it as root. I don’t think it’s good practice to install software like that, so I would encourage you to just run ‘sudo mv’ at the end.