Open In App

How to Install PHP Composer on Raspberry Pi?

Last Updated : 14 Feb, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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:

  • You can update only one specific library without updating other dependencies.
  • You can easily add a new vendor to your project by using PHP Composer.
  • You can easily install & download the Composer in any Operating system

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

downloading-the installer

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’);”

Installing-the-composer-globally

Step 3: Wait till the process is completed.

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

Verifying-the-composer


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads