๐ŸŽผ

Composer

Composer is PHP's dependency manager, maintained by the open-source Composer community. It ties for #26 in usage among developer tools, showing up in roughly 11% of surveyed projects. It's the standard way modern PHP projects โ€” Laravel, Symfony, and countless WordPress plugins โ€” declare their library dependencies and pull them straight from Packagist, PHP's central package registry.

Quick facts
Type: Dependency / package manager (PHP)
Made by: Composer open-source community
License: Free / open-source (MIT)
Platforms/Hosting: Cross-platform CLI (Windows, macOS, Linux); packages sourced from Packagist
Primary use case: Declaring, installing, and autoloading PHP library dependencies for a project
Jump to: ExampleGetting startedBest for

Example

Composer tracks your project's dependencies in a composer.json file, which you can edit by hand or update via the CLI.

# add a real HTTP client library to the project
composer require guzzlehttp/guzzle

// resulting composer.json
{
  "require": {
    "php": "^8.2",
    "guzzlehttp/guzzle": "^7.8"
  },
  "autoload": {
    "psr-4": { "App\\": "src/" }
  }
}

Getting started

Install Composer globally via its installer script, then run it from any PHP project directory.

# download and install Composer globally (Linux/macOS)
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

# install all dependencies listed in composer.json
composer install
Best for: Any PHP application or library โ€” from a Laravel API to a WordPress plugin โ€” that needs a reliable, standard way to pull in and version-lock third-party PHP packages.