TrustRadius: an HG Insights company

Composer

Score6 out of 10

3 Reviews and Ratings

What is Composer?

Composer is a dependency manager for PHP that simplifies the management of libraries and dependencies in PHP projects. It is designed to cater to the needs of web developers, software engineers, PHP developers, IT professionals, and e-commerce companies. According to the vendor, Composer offers a comprehensive solution for managing dependencies in PHP projects, making it suitable for businesses of various sizes.

Key Features

Dependency management: According to the vendor, Composer allows users to declare project dependencies and handles the installation and updating of libraries on a per-project basis, ensuring efficient and consistent dependency management.

System Requirements: Composer requires PHP 7.2.5 or later to run, with a long-term-support version offering support for legacy PHP versions. It integrates with various version control systems and relies on supporting applications for file decompression, as per the vendor's documentation.

Installation - Linux / Unix / macOS: Composer provides a convenient installer that checks PHP settings and downloads the Composer binary to the working directory. It offers both local and global installation options, as stated by the vendor.

Installation - Windows: According to the vendor, Composer provides an installer that sets up the PATH for easy access from any directory in the command line. Alternatively, Windows users can opt for manual installation by downloading the Composer binary and configuring the PATH environment variable.

Docker Image: Composer is available as a Docker container, allowing users to pull the composer/composer image and run it to install packages. It can also be integrated into existing Dockerfiles by copying the binary file from pre-built images, as per the vendor's documentation.

Using Composer: After installation, Composer allows users to declare dependencies in a composer.json file and automatically installs the required packages for the project. The composer.lock file ensures consistent installations across different environments, according to the vendor.

Libraries: Composer manages libraries on a per-project basis, resolving and installing the required versions. Libraries are installed within the project's directory, providing a structured organization, as stated by the vendor.

Command-line interface / Commands: Composer provides a command-line interface with various commands for package management. Common commands include install, update, require, remove, and show, offering flexibility and control over project dependencies, according to the vendor's documentation.

The composer.json schema: Composer follows a specific schema in the composer.json file, which includes project information, dependencies, autoload settings, and scripts. This schema ensures consistency and compatibility across Composer projects, as per the vendor's documentation.

Repositories: Composer supports different types of repositories for package discovery, including Packagist (a default package repository) and custom repositories. Users can prioritize repositories for package installation, providing flexibility in sourcing packages, according to the vendor's documentation.

Categories & Use Cases

Composer is your "must have" dependency manager

Use Cases and Deployment Scope

Composer helps us dealing with dependencies for all our projects. It automates the boring proccess of reviewing if all the dependencies are right placed/insert into a project and allows us to fastly inject any other dependecy in a project.

Pros

  • Controlling dependencies
  • Fast dependency resolver
  • Easy to use dependency injection

Cons

  • Documentation can de improved

Most Important Features

  • Controlling dependencies
  • Giving agility to software development

Return on Investment

  • Composer only has had positive impacts in our business. It saves a lot of time and resource in order to develop a software.

Other Software Used

PhpStorm, Microsoft Visual Studio Code, Docker

If you use PHP, you NEED composer now !

Use Cases and Deployment Scope

<div>We use Composer, and its indexes, packagist.org, and packagist.com (the entreprise edition of packagist.org) extensively to manage our reusable PHP modules and dependencies inside the company.</div><div>Most of our PHP projects contain only a composer.json file, which will reference external modules indexed inside Packagist, and composer is then used to fetch these dependencies at build, using the command line "composer install"

</div>

Pros

  • Dependencies management and their lifecycles
  • Composer command line is very flexible and easy to use
  • Branch and Tags for release management of the dependencies

Cons

  • Sometimes a bit slow, but v2 made a lot of improvements on that
  • If everything is modular, setting up a local dev environment is a bit trickier than having everything in the same repo
  • Might be hard to adopt with some frameworks which have not fully embraced it, like Wordpress

Most Important Features

  • Modules and dependency management for all PHP projects
  • Awareness of git tagging and branching when making internal modules
  • Ease of use inside our CI/CD pipelines, for building, testing and deploying

Return on Investment

  • Helped us reduce the TTM of our ecommerce factory by about 40% since we adopted it
  • Code re-usability became the norm, and thus much shorter development cycles
  • New websites go live much faster, and thus cost way less money to make when reusing composer modules (SSO, CRM integration, modules to call Internal APIs ...)

Alternatives Considered

npm and Yarn

Other Software Used

Magento Open Source, GitLab, Laravel PHP Framework