Sample App for PHP

Note
The php buildpack applies to this sample app. Check out the overview to see more information about limitations and configuration options for the buildpack.

We provide a sample app using PHP that you can deploy on App Platform.

To try it out, fork the PHP GitHub repository to your account so that you have a copy of it stored to the cloud.

Then, create an app using your fork of this repo as the source. App Platform will inspect the code, automatically detect the kind of component to create, and use the correct buildpack to create and deploy a container. From there, you can push changes to your fork and see App Platform automatically re-deploy the update to your app.

Tip
The README file in the root of the sample app’s repository has full instructions on how to run this particular sample, including any configuration details you may need to adjust, how to make changes and instantly see them live, and lifecycle management information.

Usage

  • We recommend using Composer for PHP apps that are deployed to App Platform. If your app does not use Composer, you must include an index.php file in the root directory of its repo.
  • PHP versions 7.x and 8.x are supported. By default, PHP 7.x will be used. To configure the version used for your app, add a php dependency to composer.json like so:
{
  "require": {
	"php": "^8.0.0"
  }
}
  • Composer versions 1.x and 2.x are supported. App Platform will determine the version to use based on the the version of Composer that generated the composer.lock file. Generally, you can update your project by running composer update --lock using Composer 2.