Composer is a PHP dependency manager, like PEAR (PHP Extension and Application Repository). The main difference is that while PEAR is used to install an extension on a server (shared between users), composer can install an extension as a package directly to your software/application.

As an example, let's imagine you are making an application and you need monolog to manage your app's log. You can do that using composer require monolog/monolog:

composer require monolog/monolog
Using version ^1.22 for monolog/monolog
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing psr/log (1.0.2)
    Loading from cache

  - Installing monolog/monolog (1.22.0)
    Downloading: 100%

monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)
Writing lock file
Generating autoload files

That's it! Monolog is ready to be used and you can see it in vendor folder:

ls -al vendor/
total 24
drwxr-xr-x 5 mbelcomu mbelcomu 4096 Dec 15 15:05 ./
drwxr-xr-x 3 mbelcomu mbelcomu 4096 Dec 15 15:05 ../
-rw-r--r-- 1 mbelcomu mbelcomu  183 Dec 15 15:05 autoload.php
drwxr-xr-x 2 mbelcomu mbelcomu 4096 Dec 15 15:05 composer/
drwxr-xr-x 3 mbelcomu mbelcomu 4096 Dec 15 15:05 monolog/
drwxr-xr-x 3 mbelcomu mbelcomu 4096 Dec 15 15:05 psr/