Documentation navigation
Anybuild documentation

PHP

Composer-aware PHP builds with framework-specific document-root detection.

Detection

The PHP provider recognizes Composer projects, PHP entry files, and Drupal, Moodle, or Symfony layouts. Laravel and WordPress projects use their dedicated providers.

Build and document root

Anybuild discovers Composer usage and build scripts, then selects a framework-specific document root such as public, app, or web. The current default PHP version is 8.3.29.

Configuration

VariablePurposeExample value
ANYBUILD_PHP_VERSIONSelect the PHP package version.8.3.29
ANYBUILD_PHP_ARCHITECTURESelect the 64-bit or 32-bit PHP package.64-bit
ANYBUILD_COMPOSER_ENABLEControl Composer installation.true
ANYBUILD_COMPOSER_BUILD_SCRIPTSelect the Composer build script to run.post-update-cmd
ANYBUILD_PHP_PUBLIC_DIROverride the document root.public
ANYBUILD_PHPIXUse the phpix runtime path.true
ANYBUILD_PHPIX_WORKER_THREADSSet the phpix worker-thread count.4

Generated definition

Anybuild
load("//anybuild/tools:php.bzl", "php_build", "php_config", "php_serve")
config = php_config(    schema = 1,    composer_enable = True,    php_version = "8.3.29",    php_public_dir = "public",)
build = php_build(config)php_serve(config, build, name = "php-api")