Open In App

How to Install PHP Composer on Raspberry Pi?

Composer is a package manager for PHP. It basically allows importing codes to the project & other work. It helps them to keep it up-to-date. It helps you to manage those dependencies. We all can use PHP composer in our machine just by installing it. But, while you are using it in Raspberry Pi we have to install properly Raspberry Os. It is the most important prerequisite. Without it, you can not be able to install and use it further. If you do not install Raspberry Pi Os then you can not open the terminal which was provided along with it. If you can not open the terminal you can not write proper commands to install the Composer or any other applications.

Features:



Installing PHP Composer on Raspberry Pi

To install PHP Composer on Raspberry Pi follow the following steps:

Step 1: Open the terminal of Raspberry Pi Os, then write the following commands step by step to download and verify the installer. 



php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”

php -r “if (hash_file(‘sha384’, ‘composer-setup.php’) === ‘906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”

php composer-setup.php

Wait for some time until the installation is completed.

Step 2: Then write the following command to install the composer globally:

php -r “unlink(‘composer-setup.php’);”

Step 3: Wait till the process is completed.

Step 4: Now, your installation is successful. Now write the following command to check your installed PHP composer version.

php composer.phar  –version

To update the composer you can use the following command:

sudo composer self-update

Article Tags :