Laravel Forge JavaScript SDK

PHP

PHP

List PHP versions

Method

forge.php.list(server_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3const phpVersions = await forge.php.list(server_id);

Example Response

1[
2 {
3 "id": 29,
4 "version": "php74",
5 "status": "installed",
6 "displayable_version": "PHP 7.4",
7 "binary_name": "php7.4",
8 "used_as_default": false,
9 "used_on_cli": false
10 },
11 {
12 "id": 30,
13 "version": "php73",
14 "status": "installed",
15 "displayable_version": "PHP 7.3",
16 "binary_name": "php7.3",
17 "used_as_default": true,
18 "used_on_cli": true
19 },
20 {
21 "id": 31,
22 "version": "php72",
23 "status": "installed",
24 "displayable_version": "PHP 7.2",
25 "binary_name": "php7.2",
26 "used_as_default": false,
27 "used_on_cli": false
28 },
29 {
30 "id": 32,
31 "version": "php71",
32 "status": "installed",
33 "displayable_version": "PHP 7.1",
34 "binary_name": "php7.1",
35 "used_as_default": false,
36 "used_on_cli": false
37 },
38 {
39 "id": 33,
40 "version": "php56",
41 "status": "installed",
42 "displayable_version": "PHP 5.6",
43 "binary_name": "php5.6",
44 "used_as_default": false,
45 "used_on_cli": false
46 }
47]

Install PHP version

Method

forge.php.install(server_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.php.install(server_id, payload);

Payload

1{
2 version: 'php74'
3}

Available Versions

KeyDescription
php56PHP 5.6
php70PHP 7.0
php71PHP 7.1
php72PHP 7.2
php73PHP 7.3
php74PHP 7.4

Upgrade PHP patch version

You must supply the version to be patched.

Method

forge.php.update(server_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.php.update(server_id, payload);

Payload

1{
2 version: 'php74'
3}

Available Versions

KeyDescription
php56PHP 5.6
php70PHP 7.0
php71PHP 7.1
php72PHP 7.2
php73PHP 7.3
php74PHP 7.4

Enable OPCache

Method

forge.php.enableOPcache(server_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.php.enableOPcache(server_id);

Disable OPCache

Method

forge.php.disableOPcache(server_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.php.disableOPcache(server_id);

Edit this page on GitHub