DEV Community

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

Posted on

3 4

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

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

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

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay