Installing a PHP application using the API
Prerequisites
To install a PHP application, you will need to have the following:
- The project ID of an existing project (how to create a project)
- The application and version ID of the generic custom PHP application (see next section)
Determine the app and app version ID
Before installing a PHP application, you will need to determine the application ID and version ID of the generic custom PHP application. Alternatively, if you want to start a PHP worker (which either runs headless, or ships its own webserver), you can use the PHP worker application ID and version ID.
For this, call the GET/
endpoint, and find the "PHP" application (or the "PHP Worker" application, respectively). You can then use that ID to retrieve the recommended version to install for this app, by calling the GET/
endpoint. You can filter the returned versions by the recommended
property.
The PHP or PHP worker applications should have the following IDs, respectively:
- PHP:
34220303-cb87-4592-8a95-2eb20a97b2ac
- PHP Worker:
fcac178a-e606-4460-a5fd-b3ad0ae7a3cc
Please note that the actual version is rather inconsequential, as it refers only to the starter template used to create the application. The actual version of the application will be determined by your own code.
Install a managed PHP application
To deploy your application, you will need to call the POST/
endpoint. The relevant fields are the following:
appVersionId
needs to be the app version ID that you retrieved in the previous step.updatePolicy
needs to be set tonone
, as you will typically want to update your application by yourself.
The complete HTTP request should look like this:
POST /v2/projects/{projectId}/app-installations HTTP/1.1
Host: api.mittwald.de
Content-Type: application/json
{
"appVersionId": "ff45ad04-8589-46d7-a645-0566be3eaeec",
"description": "Your PHP app",
"updatePolicy": "none"
}
/v2/projects/{projectId}/app-installations/
The response will contain the installation ID, that you can subsequently use to access your application.
To observe the installation status, you can call the GET/
endpoint. Pay special attention to the installationPath
field; this will contain the directory in your project file system that you should deploy your application to.
Install a PHP worker
Installing a PHP worker application works almost the same way as installing a PHP application. The only difference is that you will need to use the PHP worker application ID and version ID, and provide an entrypoint command that starts your PHP worker.
The complete HTTP request should look like this:
POST /v2/projects/{projectId}/app-installations HTTP/1.1
Host: api.mittwald.de
Content-Type: application/json
{
"appVersionId": "41f7c7f6-abbb-4d0c-9227-3ca749bce64f",
"description": "Your PHP worker",
"updatePolicy": "none",
"userInputs": [
{
"name": "entrypoint",
"value": "php server.php"
}
]
}
/v2/projects/{projectId}/app-installations/