Install the PHP microagent on Heroku applications

Heroku is a Platform as a Service (PaaS) that hosts web applications. Sqreen supports Heroku for PHP applications.

  1. Review PHP microagent compatibility to confirm that the Sqreen Microagent for PHP is compatible with your PHP application.
  2. Confirm that your app uses one of the following supported Heroku buildpacks:
    • PHP 5.6 - 7.3 in cedar-14
    • PHP 5.6 - 7.4 in heroku-16
    • PHP 7.1 - 7.4 in heroku-18
  3. Sign up to create your Sqreen account.
  4. Add the Sqreen Heroku Addon to your application. This automatically defines the SQREEN_TOKEN environment variable.
  5. Add an extra repository to the application. Choose the repository according to your buildpack.
    # cedar-14
    heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://sqreen-heroku.s3.amazonaws.com/dist-cedar-14-stable/"
    
    # heroku-16
    heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://sqreen-heroku.s3.amazonaws.com/dist-heroku-16-stable/"
    
    # heroku-18
    heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://sqreen-heroku.s3.amazonaws.com/dist-heroku-18-stable/"
    
  6. In your composer.json file, add ext-sqreen to the require section and the config/platform section.
    {
        ...
        "require": {
            "php": "^7.1.3",
            "ext-sqreen": "^1.10",
            ...
        },
        ...
        "config": {
            "platform": {
                "php": "7.1.3",
                "ext-sqreen": "1.10.0"
            },
            ...
        },
        ...
    }
    
  7. From Terminal, in your application root directory, commit your changes and push them to Heroku. This triggers Heroku to deploy your modifications.
    git commit -m 'Add Sqreen to my application' package.json
    git push heroku master
    

Learn more about using Sqreen with Heroku: