1. Go to this page and download the library: Download mcgo/heroku-web-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
try {
// Instantiate a new HerokuWebAPI object
$heroku = new HerokuWebAPI();
// Get the current dyno size of web dynos
$web_size = $heroku->getDynoSize('web');
// Get the current siez of worker dynos
$worker_size = $heroku->getDynoSize('worker');
// Scale worker to 100
$heroku->scaleDyno('worker', 100);
// Control another app with the same key. The $heroku methods setApp, setKey and scaleDyno support method chaining, so you could do something like this.
$heroku->setApp('my-other-app')->scaleDyno('web', 1)->scaleDyno('worker', 0);
// Please note, that if you use credentials only by settings them with the methods, it is important to do it directly
// after newing up the Object. Otherwise it would result in a HerokuCredentialsNotSetException. This is no correct
// usage and will only work if environment variables are set.
$wrongusage = new HerokuWebAPI();
$wrongusage->scaleDyno('web', 0)->setApp('my-app');
} catch (HerokuCredentialsNotSetException $e) {
// The credentials are not set. Either do so by using the environment
// variables HEROKU_KEY and HEROKU_APP or storing them by using the
// appropriate methods setApp() and setKey();
} catch (HerokuRequestFailedException $e) {
// The request to Heroku was not completed with a 200 status.
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.