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 require will add a dependency to the composer.json file and install it into the vendor subdirectory, creating the vendor folder if it does not already exist.
  • composer install will install packages already “required” in composer.json.
  • 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.

IBM i Development

  • RPG, COBOL, SQL, Node,
    PHP, Python, Valance, etc.
  • Modernization. Integration.
  • Web and API Solutions
  • Legacy Maintenance
    ...
(or call 201.447.2437)
Open source support for IBM i

Got PHP Issues?
GET ANSWERS!

Your PHP should be trouble-free. If your current PHP environment is anything less than perfect, we can help!

SSL /TLS for IBM i