Composer is a popular tool for managing PHP dependencies and packages. It also provides an autoloader for PHP classes. We recommend its use for new PHP projects.

Installing Composer

Although you can install Composer from, you can save that effort by installing Composer from our CommunityPlus+ PHP repository. Our repository conveniently includes Composer as an RPM package. In fact, Composer may already have been installed if you used our recommended command (yum install “php-*”) when you installed CommunityPlus+ PHP. If not, you can add the “php-composer” package via ACS’s Open Source Management window, or with this command from a PASE shell:

yum install php-composer

No additional setup or environment variables are required. Composer can now be found in the standard location for open source packages, under /QOpenSys/pkgs/bin. You can invoke it as “composer”, so long as the open source path is set.

Using Composer

Full documentation for getting started with and using Composer is available from the Composer documentation. An executive summary:

  • Run Composer from the root directory of your project.
  • composer.json is the file that lists what dependencies your project has.
  • composer install will install required packages specified for your project. composer update will bring up packages to the newest version possible.
  • Packages are installed into the “vendor” folder. They are not installed globally, but on a per-project basis.
  • The lock file represents what packages should be installed; running an update will change the lock file. You can use this to ensure you get the same version of packages installed with the same lock file.
  • Composer generates an autoload file, which you can use to easily reference installed packages.