Skip to content

PHP Functions

🛠️ Tools · ⬅ Top


phpInstall

Install php

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. Return Code: 1 - If installation fails Return Code: 0 - If installation succeeds

Arguments

  • package - Additional packages to install

Return codes

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

composer.sh

Run Composer commands on code

Usage

composer.sh [ --help ] [ installDirectory ]

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.

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.

Arguments

  • installDirectory - 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 - This help

Examples

phpComposer ./app/

Return codes

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

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 runHook 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.

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

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 - Success
  • 1 - Environment error
  • 2 - Argument error

phpComposerInstall

Install composer for PHP

Usage

phpComposerInstall

Install composer for PHP

Arguments

  • none

Return codes

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

phpBuild

Build deployment using composer, adding environment values to .env and

Usage

phpBuild [ --name tarFileName ] [ --suffix versionSuffix ] [ --debug ] [ ENV_VAR1 ... ] -- file1 [ file2 ... ]

Build deployment using composer, adding environment values to .env and packaging vendor and additional files into target file, usually BUILD_TARGET

Override target file generated with environment variable BUILD_TARGET which must ae set during build and on remote systems during deployment.

Files are specified from the application root directory.

phpBuild generates the .build.env file, which contains the current environment and:

  • BUILD_TARGET
  • BUILD_START_TIMESTAMP
  • APPLICATION_TAG
  • APPLICATION_ID

Arguments

--skip-tag |- --no-tag - Optional. Flag. Do not tag the release. - --name tarFileName - String. Optional. Set BUILD_TARGET via command line (wins) - --composer arg - Optional. Argument. Supply one or more arguments to phpComposer command. (Use multiple times) - --help - Optional. Flag. Display this help. - ENV_VAR1 - Optional. Environment variables to build into the deployed .env file - -- - Required. Separates environment variables to file list - file1 file2 dir3 ... - 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

phpLog

Outputs the path to the PHP log file

Usage

phpLog

Outputs the path to the PHP log file

Arguments

  • none

Return codes

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

phpTest

Test a docker-based PHP application during build

Usage

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

Test a docker-based PHP application during build

Arguments

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

Return codes

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

phpIniFile

Outputs the path to the PHP ini file

Usage

phpIniFile

Outputs the path to the PHP ini file

Arguments

  • none

Return codes

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

phpTailLog

Tail the PHP log

Usage

phpTailLog [ --help ]

Tail the PHP log

Arguments

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

Return codes

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