DEV Community

Cover image for Introduction to Composer [installation and components]
anastasionico
anastasionico

Posted on

Introduction to Composer [installation and components]

If someone asks you what was the best invention in the PHP realm during the last decade,
what would be your answer?

We have seen many updates in PHP during the last couple of years, we had the advent of PHP 7, Laravel and Symfony have reached a de-facto status, components such as PHPUnit and Xdebug are now standard for the majority of professionals, also through the use of package like Guzzle making and retrieving data from API has never been this simple.

If you have noticed all of these improvements come from the same place, and that would be my answer to the question above.

The best thing that has happened in PHP during the last decade is without any doubt Composer.

I still remember that more than a decade ago my teacher in school used to tell me that programmers are lazy people, and the lazier you are the best you can become as a programmer.

Composer is the essence of this statement.
There is no need to reinvent the weel.
Chance are that feature you need has been already developed and tested by a multitude of web developers all around the world.
Composer is a dependency manager, it provides packages containing the solution of your application problem under the shape of code.

in this new series, we'll go through all the documentation of Composer in an easy-to-read way and with lots of examples.

CLICK HERE TO READ THE FULL ARTICLE

Top comments (4)

Collapse
 
peter279k profile image
peter279k

Nice tutorial! And it also misses some useful commands.

For example, using following command to configure the mirror site:

composer config -g repos.packagist composer https://packagist.org

Using following command to clear local cached dependencies source file:
It can avoid loading from cache when installing some dependencies via composer install or composer update.

composer clear-cache
Collapse
 
anastasionico profile image
anastasionico

Great answer Peter,
I didn't add this in here because this article is supposed to be a starting point for who is discovering Composer for the first time.
I'll write about those commands when I'll touch on the command-line interface and its commands

Collapse
 
peter279k profile image
peter279k

Thanks for your reply. As you say, these commands I mention are for PHP developer using advanced Composer commands.

Perhaps you can add these commands on your another blog post about advanced Composer usage :).

Thread Thread
 
anastasionico profile image
anastasionico

I will for sure