Seiden Group
Modern Development & Open Source for IBM i
  • Link to LinkedIn
  • Link to Mail
  • Home
  • Seiden PHP+
    • Seiden PHP+
    • Install & Learn
    • SmartSupport
    • PHP Migrations & Upgrades
    • Success Stories
    • Free PHP Assessment
    • Documentation
    • What’s New (Changelog)
  • IBM i Services
    • Development
    • Training & Mentoring
    • Open Source Setup & Upgrades
    • SSL/TLS Install & Learn
    • Performance
  • Support
    • Open Source & PHP
    • VS Code for i
    • Developer Support
    • Support Success Stories
  • VS Code for i
    • Support
    • Training
    • Code for i Resource Guide
    • Getting Started Videos
    • Code for IBM i Fridays
  • Free Stuff
    • IBM i Strategy & Tips
    • PHP Upgrade Assessment
    • CNX Valence Assessment
    • VS Code for IBM i Resources
    • Code for IBM i Fridays
    • QCachegrind Download
    • PHP Toolkit for IBM i Resources
    • Qshell on i Library
  • Blog
  • About
    • About Our Team
    • About Alan Seiden
    • Speakers & Sessions
    • In the News
  • Contact
  • 201.447.2437
  • Search
  • Menu Menu

Seiden Group Blog

Installing Composer on IBM i

April 2, 2018/2 Comments/in PHP /by Stephanie Rabbani

Composer, a tool to manage dependencies in PHP applicationsThe open source Composer tool, which manages PHP project dependencies, has become standard equipment for modern PHP. New to this tool? I recommend this introduction to Composer.

Composer automatically installs or updates required components, known as dependencies, and any others required by those initial components. The required components are defined by the developer in an easy-to-read JSON-formatted text file.

Update: March 2021

The instructions in this blog post are outdated. We provide updated instructions in our Seiden PHP+ documentation.

Composer is now included with Seiden PHP+, so you don’t have to install Composer separately.

Updated instructions: Installing and Using Composer with Seiden PHP+.

Dependencies?

Say my application uses a PHP framework such as Zend Framework 3 or Laravel. My application depends on that PHP framework, which, in turn, might depend on something else being installed. Once you define the top-level component, or dependency (in this case, ZF3 or Laravel), and run the “composer install” command, Composer will download any needed components to the vendor folder.

Component autoloading

Composer also allows you to choose bits and pieces (components) from various frameworks or libraries. Furthermore, it creates an autoloader, so that your application doesn’t have to know the exact path of the component. You can point your application to the component’s autoloader, and you are set to go. It really saves you time and headaches once you get used to using it.

How? (IBM i–specific)

Use either the PASE shell (QP2TERM) by running CALL QP2TERM from the command line, or, better, an SSH terminal shell.

Steps In Brief:

1. Add PHP to classpath
2. Run Composer installer
3. Copy it to php bin library
4. Use it!

Hot Tip: If you get out-of-memory errors when running Composer, try these steps:

1. Increase PASE memory:

1
export LDR_CNTRL=MAXDATA=0xB0000000@DSA

before executing your PHP composer commands.

2. In your php command string, add a string resembling

1
-d memory_limit=512M

right after the php, to make something like:

1
php -d memory_limit-512 [rest of command goes here]<code>

Step 1  – Add PHP to classpath

You can run the following commands on the QP2TERM or SSH command line (you’d need to do this each time you start a QP2TERM or SSH session):

1
2
3
4
$ PATH=$PATH:/usr/local/zendphp7/bin
$ LIBPATH=$LIBPATH:/usr/local/zendphp7/bin
$ export PATH
$ export LIBPATH

Or you can create or modify a file called .profile with those exact commands in /home/YOURUSERPROFILEHERE/

See this article:

https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rzahz/rzahzcustom.htm

I find if I use EDTF to create the file, it creates the file with CCSID 37 (EBCDIC). If, however, I create it in a PC-based text editor and move it to the IFS, the file will be CCSID 819 or 1208, which PHP can understand.

Step 2 – Install

Official installation instructions: https://getcomposer.org/download/

Summarized:

PHP
1
$ php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php

(on one system, it wouldn’t allow me to run https, so I changed the URL to http.)

1
2
3
$ php composer-setup.php
 
$ php -r "unlink('composer-setup.php');"

Step 3 – Copy the archive file to the PHP binary directory

1
$ mv composer.phar /usr/local/zendphp7/bin

Step 4 – Use it!

Create a composer.json configuration file in your project folder. I could take a closer look at composer.json in a future post if there is interest from our readers.

Now, run composer install!

1
$ composer.phar install

Watch your folders fill with dependencies :)

Now add

1
require __DIR__ . '/vendor/autoload.php';

at the top of your application code. Composer can now create component object instances as you need them.

Part of my job at Seiden Group, besides developing applications for clients, is to help the IBM i platform appeal to fresh talent. On any given day, I might teach open source to IBM i professionals, or I might empower Linux-oriented developers to thrive on IBM i. If you would like to jump-start your application development with tools such as Composer or Git, or speed development of a great application, let us know.

Tags: autoloader, Composer, IBM i, IBMi, IBMiOSS, pase, PHP, SeidenPHP
Share this entry
  • Share on Facebook
  • Share on X
  • Share on Pinterest
  • Share on LinkedIn
  • Share on Tumblr
  • Share on Reddit
  • Share by Mail
https://www.seidengroup.com/wp-content/uploads/2017/03/SeidenLogo-180.png 0 0 Stephanie Rabbani https://www.seidengroup.com/wp-content/uploads/2017/03/SeidenLogo-180.png Stephanie Rabbani2018-04-02 10:00:362025-12-15 11:27:06Installing Composer on IBM i
Stephanie Rabbani

About Stephanie Rabbani

A senior consultant for Seiden Group, Stephanie has been developing web applications on the IBM i for over 14 years. She previously worked for BCD Software ...Read More

2 replies
  1. Bill Blalock
    Bill Blalock says:
    December 13, 2019 at 6:42 pm

    Great article. Just what I needed to install composer on an IBM i with ZEND server. I hope I will see more articles on PHP and PACE tools for the IBM i.

    I would appreciate learning about composer.json configuration file on an IBM i.

    Thank you

    Reply
    • Alan Seiden
      Alan Seiden says:
      January 3, 2020 at 12:42 pm

      Thanks, Bill! We will continue to write more articles on PHP, open source, PASE, and IBM i.

      Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

SUBSCRIBE
Open Thinking
Monthly IBM i Strategy & Tips
  • This field is for validation purposes and should be left unchanged.

IBM i Development

  • RPG, COBOL, SQL, Node,
    PHP, Python, Valance, etc.
  • Modernization. Integration.
  • Web and API Solutions
  • Legacy Maintenance
    ...
LET'S GET IT DONE!

Recent Posts

  • Moving to IBM i 7.6? An SDA Alternative with VS Code and IBM Bob
  • What’s New with Mapepire Database Connector for IBM i
  • Do You Need IBM i Observability?
  • PHP 8.6 is Coming Soon to IBM i
  • Safer npm installation is on the way for Node.js (and all JavaScript)
  • Access Modern Security for IBM i and Connected Web Environments
  • IBM i: A Natural Platform for Agentic AI
  • PHP on IBM i in 2026: The Modernization Engine
  • Your “AS/400” Is a Modern IBM i Platform
  • MCP + AI for IBM i Teams (with a MongoDB example)

SEIDEN GROUP: Modern Development & Open Source for IBM i

Home   |   Seiden PHP+   |   IBM i Services  |   Support   |   VS Code for i   |   Free Stuff   |   Blog  |   Privacy Policy  |   Contact         201.447.2437

© 2026 Seiden Group, LLC
  • Link to LinkedIn
  • Link to Mail
Link to: GitHub — A Collaboration Tool for Developers Link to: GitHub — A Collaboration Tool for Developers GitHub — A Collaboration Tool for Developers Link to: Steve Will Discusses IBM i Strategy Link to: Steve Will Discusses IBM i Strategy Steve Will Discusses IBM i Strategy
Scroll to top Scroll to top Scroll to top