How to Add PHP Libraries to a Pod

Learn how to add non-standard PHP extensions to your pod.  Most extensions can be installed without additional configurations.  However, some extensions (e.g., oci8) require additional libraries be installed and configured. 

Operating System: Any

Applies To: Faculty or Staff using CaaS (Formerly WebApps)

Last Updated: November  17, 2022

What Is a Library?

A library is a collection of PHP classes (native PHP code) which solve generic tasks such as building HTML forms and sending emails. PHP libraries are usually fairly easy to install and use. Examples of PHP libraries include:

  • phpseclib
  • pchart
  • recaptcha
  • ratchet
  • mink

Prerequisites

Instructions

1. Add a composer.json file to your repository using the following structure.  You will need to replace the items enclosed in "< >" with the appropriate values.

composer.json

  1. {
  2.     "require": {
  3.         "<first_library_name>": "<version_requirements>",
  4.         "<second_library_name>": "<version_requirements>",
  5.         "<third_library_name>": "<version_requirements>"
  6.     }
  7. }

Example composer.json File

The following composer.json file will cause your pod to install any 2.x version of the phpseclib library:

{

    "require": {

        "phpseclib/phpseclib": "2.*"

    }

}

See also

Still need help?

Contact the UBIT Help Center.