Skip to content

PHP Functions

🛠️ Tools · ⬅ Home


Usage

phpInstall [ package ]

Install php If this fails it will output the installation log. When this tool succeeds the php binary is available in the local operating system.

Arguments

  • package - Additional packages to install

Return codes

  • 1 - If installation fails
  • 0 - If installation succeeds

composer.sh

Run Composer commands on code

Usage

composer.sh installDirectory [ --help ]

Runs composer validate and install on a directory. If this fails it will output the installation log. When this tool succeeds the composer tool has run on a source tree and the vendor directory and composer.lock are often updated. This tools does not install the composer binary into the local environment.

Arguments

  • installDirectory - Directory. Required. You can pass a single argument which is the directory in your source tree to run composer. It should contain a composer.json file.
  • --help - Flag. Optional. Display this help.

Examples

phpComposer ./app/

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Local cache

This tool uses the local .composer directory to cache information between builds. If you cache data between builds for speed, cache the .composer artifact if you use this tool. You do not need to do this but 2nd builds tend to be must faster with cached data.

Environment

  • BUILD_COMPOSER_VERSION - String. Version of composer to use for building vendor directory
  • String. Default to latest. Used to run docker run composer/$BUILD_COMPOSER_VERSION on your code

phpComposerSetVersion

For any project, ensures the version field in composer.json matches

Usage

phpComposerSetVersion [ --version ] [ --home ] [ --status ] [ --quiet ]

For any project, ensures the version field in composer.json matches hookRun version-current Run as a commit hook for any PHP project or as part of your build or development process Typically the version is copied in without the leading v.

Arguments

  • --version - String. Use this version instead of current version.
  • --home - Directory. Optional. Use this directory for the location of composer.json.
  • --status - Flag. Optional. When set, returns 0 when te version was updated successfully and $(returnCode identical) when the files are the same
  • --quiet - Flag. Optional. Do not output anything to stdout and just do the action and exit.

Return codes

  • 0 - File was updated successfully.
  • 1 - Environment error
  • 2 - Argument error
  • 105 - Identical files (only when --status is passed)

phpComposerInstall

Install composer for PHP

Usage

phpComposerInstall

Install composer for PHP

Arguments

  • none

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Arguments

--skip-tag |- --no-tag - Flag. Optional. Do not tag the release. - --name tarFileName - String. Optional. Set BUILD_TARGET via command line (wins) - --composer arg - Argument. Optional. Supply one or more arguments to phpComposer command. (Use multiple times) - --help - Flag. Optional. Display this help. - environmentVariable ... - EnvironmentVariable. Optional. Environment variables to build into the deployed .env file - -- - Separator. Required. Separates environment variables to file list - file1 file2 dir3 ... - File|Directory. Required. List of files and directories to build into the application package.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

See Also

  • BUILD_TARGET - String. The file to generate when generating builds

Usage

phpLog

Outputs the path to the PHP log file

Arguments

  • none

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Usage

phpTest [ --env-file envFile ] [ --home homeDirectory ]

Test a docker-based PHP application during build

Arguments

  • --env-file envFile - File. Optional. Environment file to load.
  • --home homeDirectory - Directory. Optional. Directory for application home.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Usage

phpIniFile

Outputs the path to the PHP ini file

Arguments

  • none

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Usage

phpTailLog [ --help ]

Tail the PHP log

Arguments

  • --help - Flag. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error