PHP Buildpack on App Platform

App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.


How App Platform Builds Images

App Platform supports two ways to build an image for your app: Cloud Native Buildpacks and Dockerfiles.

When you give App Platform access to your code, it defaults to using a Dockerfile if one is present in the root of the directory or specified in the app spec. Otherwise, App Platform checks your code to determine what language or framework it uses. If it supports the language or framework, it chooses an appropriate resource type and uses the proper buildpack to build the app and deploy a container.

heroku-buildpack-php is utilized as the buildpack for detecting and building your PHP applications.

PHP Applications using Buildpacks

App Platform looks for any of the following to detect a PHP application:

  • composer.json
  • index.php

PHP Version

  • PHP versions 7.x and 8.x are supported. PHP 7.x will be used by default, unless a specific version is requested via composer.json by your app or a dependency. To configure the version used for your app, add a php dependency to composer.json like so:
{
  "require": {
    "php": "^8.0.0"
  }
}

Limits

Composer versions 1.x and 2.x are supported. App Platform will determine the version to use based on the version of Composer that generated the composer.lock file. Generally, you can update your project by running composer update --lock using Composer 2.