Download the PHP package mcgo/heroku-web-api without Composer
On this page you can find all versions of the php package mcgo/heroku-web-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mcgo/heroku-web-api
More information about mcgo/heroku-web-api
Files in mcgo/heroku-web-api
Package heroku-web-api
Short Description Use the Heroku web API from within your PHP application
License MIT
Informations about the package heroku-web-api
Heroku Web API
This package could be used to scale dynos and get information on current dyno sizes. If there are more needs to use the heroku API create a pull request and will be implemented soon.
Install the package
The package could be installed by using composer like this and be used like any other composer package afterwards (see https://getcomposer.org/doc/01-basic-usage.md for basic usage).
Basic usage information
To use the package you need to know your heroku key and the machine readble app name. Both could be fetched from your heroku account page under security. The package uses two methods to setup the credentials for communicating with your heroku app.
Credentials via environment variables
Make sure you have created a environment variable for the app and the key with the Names HEROKU_KEY
and HEROKU_APP
. These will be used automatically. If they are not found, an Exception will be thrown.
Set credentials manually
If you do not want to use environment variables are want to communicate with more than one app, you could directly set the correct values by using the appropriate methods setApp()
and setKey()
. Check the example below.
Usage as Laravel ServiceProvider
You could use this package from inside your Laravel application as a service provider. Just add a line to your app's config provider array in config/app.php
like this:
and to your aliases:
Afterwards you could use it everywhere in your app like Heroku::scaleDyno('worker', 1)
or to show the current size of your dynos in a blade template Heroku::getDynoSize('web')