File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,6 +114,12 @@ $ploi->servers(123)->monitoring();
114114// Get PHP versions installed on server
115115$ploi->servers(123)->phpVersions();
116116
117+ // Install a PHP version on server
118+ $ploi->servers(123)->installPhpVersion('8.3');
119+
120+ // Switch PHP CLI version on server
121+ $ploi->servers(123)->switchPhpCliVersion('8.3');
122+
117123// Enable opcache
118124$ploi->servers(123)->opcache()->enable();
119125
Original file line number Diff line number Diff line change @@ -183,6 +183,32 @@ public function phpVersions(?int $id = null): Response
183183 return $ this ->callApi ('php/versions ' );
184184 }
185185
186+ public function installPhpVersion (string $ version ): Response
187+ {
188+ $ this ->setIdOrFail ();
189+
190+ $ options = [
191+ 'body ' => json_encode ([
192+ 'version ' => $ version ,
193+ ]),
194+ ];
195+
196+ return $ this ->callApi ('php/install ' , 'post ' , $ options );
197+ }
198+
199+ public function switchPhpCliVersion (string $ version ): Response
200+ {
201+ $ this ->setIdOrFail ();
202+
203+ $ options = [
204+ 'body ' => json_encode ([
205+ 'version ' => $ version ,
206+ ]),
207+ ];
208+
209+ return $ this ->callApi ('php/cli-version ' , 'post ' , $ options );
210+ }
211+
186212 public function restart (?int $ id = null ): Response
187213 {
188214 $ this ->setIdOrFail ($ id );
You can’t perform that action at this time.
0 commit comments