A Cloud Foundry Buildpack for PHP.
Repo cloudfoundry/php-buildpack, read from GitHub 1 min ago. cloudfoundry has not joined Take My Repo.
cloudfoundry/php-buildpack is a public repo on GitHub by cloudfoundry. A Cloud Foundry Buildpack for PHP. It declares the Apache-2.0 license on GitHub. It is written mainly in Go, has 145 stars and last changed on 2026-11-19. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-19.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
A buildpack to deploy PHP applications to Cloud Foundry based systems, such as a cloud provider or your own instance.
Official buildpack documentation can be found here: php buildpack docs.
Developer Documentation:
To build this buildpack, run the following commands from the buildpack's directory:
Source the .envrc file in the buildpack directory.
source .envrcTo simplify the process in the future, install direnv which will automatically source .envrc when you change directories.
Install buildpack-packager
go install github.com/cloudfoundry/libbuildpack/packager/buildpack-packager@latest
Build the buildpack
buildpack-packager build [ --cached ]
Alternatively, use the package script:
./scripts/package.sh [ --cached ]
Use in Cloud Foundry
Upload the buildpack to your Cloud Foundry and optionally specify it by name
cf create-buildpack [BUILDPACK_NAME] [BUILDPACK_ZIP_FILE_PATH] 1 cf push my_app [-b BUILDPACK_NAME]
Find our guidelines here.
Buildpacks use the Switchblade framework for running integration tests against Cloud Foundry. Before running the integration tests, you need to login to your Cloud Foundry using the cf cli:
cf login -a https://api.your-cf.com -u name@example.com -p pa55woRD
Note that your user requires permissions to run cf create-buildpack and cf update-buildpack. To run the integration tests, run the following commands from the buildpack's directory:
Source the .envrc file in the buildpack directory.
source .envrcTo simplify the process in the future, install direnv which will automatically source .envrc when you change directories.
Run unit tests
./scripts/unit.sh
Run integration tests
./scripts/integration.sh
More information can be found on Github switchblade.
The project is broken down into the following directories:
bin/ - Executable shell scripts for buildpack lifecycle: detect, supply, finalize, release, startsrc/php/ - Go source code for the buildpack
detect/ - Detection logicsupply/ - Dependency installation (PHP, HTTPD, Nginx)finalize/ - Final configuration and setuprelease/ - Release informationextensions/ - Extension system (composer, newrelic, appdynamics, sessions)config/ - Configuration managementoptions/ - Options parsinghooks/ - Lifecycle hooks (dynatrace integration)integration/ - Integration testsunit/ - Unit testsdefaults/ - Default configuration filesfixtures/ - Test fixtures and sample applicationsscripts/ - Build and test scriptsThis buildpack uses Cloud Foundry's libbuildpack framework and is written in Go. The buildpack lifecycle consists of:
Detect (bin/detect → src/php/detect/) - Determines if the buildpack should be used by checking for PHP files or composer.json
Supply (bin/supply → src/php/supply/) - Installs dependencies:
Finalize (bin/finalize → src/php/finalize/) - Final configuration:
.bp/bin/Release (bin/release → src/php/release/) - Provides process types and metadata
bin/start → src/php/start/cli/) - Process management:
.procs fileThe buildpack uses a two-tier placeholder system for configuration files:
@{VAR})These placeholders are replaced during the finalize phase (staging/build time) with known values:
@{HOME} - Replaced with dependency or app directory path@{DEPS_DIR} - Replaced with /home/vcap/deps@{WEBDIR} - Replaced with web document root (default: htdocs)@{LIBDIR} - Replaced with library directory (default: lib)@{PHP_FPM_LISTEN} - Replaced with PHP-FPM socket/TCP address@{TMPDIR} - Converted to ${TMPDIR} for runtime expansion@{PHP_EXTENSIONS} - Replaced with extension directives@{ZEND_EXTENSIONS} - Replaced with Zend extension directives@{PHP_FPM_CONF_INCLUDE} - Replaced with fpm.d include directiveExample (php.ini):
; Before finalize: extension_dir = "@{HOME}/php/lib/php/extensions" include_path = "@{HOME}/@{LIBDIR}" ; After finalize: extension_dir = "/home/vcap/deps/0/php/lib/php/extensions" include_path = "/home/vcap/deps/0/lib"
${VAR})These are standard environment variables expanded at runtime:
${PORT} - HTTP port assigned by Cloud Foundry (dynamic)${TMPDIR} - Temporary directory (can be customized)${HOME} - Application directory${HTTPD_SERVER_ADMIN} - Apache admin emailSupported by:
${VAR}${VAR}${PORT} and ${TMPDIR} via sed replacementExample (httpd.conf):
Listen ${PORT} # Expanded by Apache at runtime ServerRoot "${HOME}/httpd" # Expanded by Apache at runtime DocumentRoot "${HOME}/htdocs" # Expanded by Apache at runtime
Note: Custom placeholders are not supported. To use custom configuration values, either:
${VAR} syntax (works with Apache/bash)The buildpack includes several built-in extensions written in Go:
composer.json and validates against locked dependencies.dynatrace and credentials containing apiurl, environmentid, and apitoken.Extensions implement the Extension interface defined in src/php/extensions/extension.go:
type Extension interface { Name() string ShouldCompile(ctx *Context) (bool, error) Configure(ctx *Context) error Compile(installer Installer) error PreprocessCommands(ctx *Context) ([]string, error) ServiceCommands(ctx *Context) (map[string]string, error) ServiceEnvironment(ctx *Context) (map[string]string, error) }
Extension Lifecycle:
For examples, see the built-in extensions in src/php/extensions/.
The buildpack supports user-defined extensions through the .extensions/ directory. This allows you to add custom startup commands, environment variables, and services without modifying the buildpack itself.
Create a directory .extensions/<name>/ in your application with an extension.json file:
myapp/
├── .extensions/
│ └── myext/
│ └── extension.json
├── index.php
└── .bp-config/
└── options.json
{
"name": "my-custom-extension",
"preprocess_commands": [
"echo 'Running setup'",
["./bin/setup.sh", "arg1", "arg2"]
],
"service_commands": {
"worker": "php worker.php --daemon"
},
"service_environment": {
"MY_VAR": "my_value",
"ANOTHER_VAR": "another_value"
}
}Fields:
name - Extension identifier (defaults to directory name)preprocess_commands - Commands to run at container startup before PHP-FPM starts. Each command can be a string or array of arguments.service_commands - Map of long-running background services (name → command)service_environment - Environment variables to set for servicesRun custom commands at container startup before PHP-FPM starts. Useful for migrations, cache warming, or other initialization tasks.
Configuration (.bp-config/options.json):
{
"ADDITIONAL_PREPROCESS_CMDS": [
"php artisan migrate --force",
"php artisan config:cache",
["./bin/setup.sh", "arg1", "arg2"]
]
}Commands can be:
"echo hello" - runs as a single command["script.sh", "arg1"] - arguments joined with spacesFor CLI/worker applications that don't need a web server or PHP-FPM, you can run a PHP script directly.
Configuration (.bp-config/options.json):
{
"WEB_SERVER": "none",
"APP_START_CMD": "worker.php"
}Auto-detection: If WEB_SERVER is set to "none" and APP_START_CMD is not specified, the buildpack searches for these entry point files:
app.phpmain.phprun.phpstart.phpIf none are found, it defaults to running PHP-FPM only (for custom proxy setups).
Example worker script:
<?php // worker.php - Long-running background worker echo "Worker started\n"; while (true) { // Process jobs from queue processNextJob(); sleep(1); }
Note: Standalone apps on Cloud Foundry may need special health check configuration since they don't have an HTTP endpoint.
Join the #buildpacks channel in our Slack community
This project is managed through GitHub. If you encounter any issues, bug or problems with the buildpack please open an issue.
The project backlog is on Pivotal Tracker
cloudfoundry/php-buildpack is a public repo on GitHub by cloudfoundry. A Cloud Foundry Buildpack for PHP.
It declares the Apache-2.0 license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-19. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Deploy static HTML/JS/CSS apps to Cloud Foundry
Cloud Foundry buildpack for Node.js
Cloud Foundry BOSH is an open source tool chain for release engineering, deployment and lifecycle management of large scale distributed services.

Cloud Foundry buildpack for running Java applications
The canonical open source deployment manifest for Cloud Foundry