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 composer.org, you can save that effort by installing Composer from our Seiden 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 Seiden 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. A summary:
- Composer should always be run from a terminal after “cd”-ing into the root directory of your project.
composer requirewill add a dependency to thecomposer.jsonfile and install it into thevendorsubdirectory, creating the vendor folder if it does not already exist.composer installwill install packages already “required” incomposer.json.composer updatewill 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.


