Require the bundle as a dependency with composer:
$ composer require zsturgess/herokuizemebundle
Enable the bundle in the dev section of the Symfony kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
);
if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
// ...
$bundles[] = new ZacSturgess\HerokuizeMeBundle\ZacSturgessHerokuizeMeBundle();
// ...
}
The bundle provides a single command, herokuize:me
that can be used to complete the rest of the setup:
$ php bin/console herokuize:me
The command will install the deploy hook that will auto-detect when the project is being pushed to heroku and make some configuration changes in order to make it run smoothly on production, as well as run an initial sense-check for implicit, undeclared dependencies on PHP extensions.
The herokuize:me
command may prompt you to commit changes to your project's composer.json
and composer.lock
files. If so, commit these before making any other changes.
Finally, your project should be ready to push to Heroku. When Heroku builds your app, HeokuizeMeBundle will make extra changes to the Symfony configuration of your project that only make sense on Heroku (for example: redirecting Symfony logs to event streams)
To set parameters, you need to set config variables prefixed with SYMFONY__
. For example, to set the database_host
parameter you'll need to set the SYMFONY__DATABASE_HOST
config variable. You'll also need to set an additional SYMFONY_ENV
config variable set to dev
or prod
.