Skip to content

PHP Functions


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.

Location: bin/build/tools/php.sh

Arguments

  • package - Additional packages to install

Return codes

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

phpComposer

Run Composer commands on code

Usage

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

Location: bin/build/tools/php-composer.sh

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 Composer VersionString. 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.

Location: bin/build/tools/php-composer.sh

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

Location: bin/build/tools/php-composer.sh

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 [ --skip-tag | --no-tag ] [ --name tarFileName ] [ --composer arg ] [ --help ] [ environmentVariable ... ] -- file1 file2 dir3 ...

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

Location: bin/build/tools/php.sh

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

Environment

phpLog

Outputs the path to the PHP log file

Usage

phpLog

Outputs the path to the PHP log file

Location: bin/build/tools/php.sh

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

Location: bin/build/tools/php.sh

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

phpIniFile

Outputs the path to the PHP ini file

Usage

phpIniFile

Outputs the path to the PHP ini file

Location: bin/build/tools/php.sh

Arguments

  • none

Return codes

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

phpTailLog

Tail the PHP log

Usage

phpTailLog [ --help ]

Tail the PHP log

Location: bin/build/tools/php.sh

Arguments

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

Return codes

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

See Also


🛠️ Tools · ⬅ Top