How to Verify if you Already Have Composer 2.6.6 Installed | Easy Guide

Dany Rivera
2 min readDec 22, 2023

If you alredy follow the steps to install composer 2.6.6 but you are not sure if if you already have it, here is how you can verify it.

In the previous versions you need to run composer or composer -v, but no if you run that command you probably are gonna get the following error:

Error:

PHP Parse error: syntax error, unexpected ‘ | ’ expecting variable (T_VARIABLE) in /

Parse error: syntax error, unexpected ‘ | ’ expecting variable (T_VARIABLE) in /

The solution of this error is very simple, in the version (2.6.6) you will need to run:

php composer.phar

After you run that command it should appear to you the next screen:

How to Install Composer 2.6.6?

If you realize you don’t have composer in your system here is an easy guide of how you can install composer 2.6.6.

To quickly install Composer in the current directory, run the following script in your terminal.

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

In the next command you need to get “Installer verified”, if you get “Installer corrupt” try again.

php -r "if (hash_file('sha384', 'composer-setup.php') === 'e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Then, you most likely, you want to put the composer.phar into a directory on your PATH, so you can simply call composer from any directory (Global install), using for example:

sudo mv composer.phar /usr/local/bin/composer

The information of how you can install composer 2.6.6 is was getting from the Oficial Documentation of Composer.

I hope this article help you to verify if you already have composer installed or to install it, thanks for reading and follow me for more!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Dany Rivera
Dany Rivera

Written by Dany Rivera

My name is Luis Daniel, I'm from Mexico, I'm a FrontEnd Developer, I've have a passion for technology and by how great apps and websites are built.

No responses yet

Write a response