Get support for dunglas/api-platform-heroku

If you're new to LTH, please see our FAQ for more information on what it is we do.

Support Options

Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:

View Open Issues

Take a look to see if anyone else has experienced the same issue as you and if they managed to solve it.

Open an Issue

Make sure to read any relevant guidelines for opening issues on this repo before posting a new issue.

Sponsor directly

Check out the page and see if there are any options to sponsor this project or it's developers directly.

dunglas/api-platform-heroku

API Platform and Symfony helpers to deploy on Heroku

This library eases the deployment of API Platform and Symfony applications on the Heroku platform.

Build Status Scrutinizer Code Quality SensioLabsInsight Dependency Status

Install

Use Composer to install the library in your project:

composer require dunglas/api-platform-heroku

Database helper

The library provides a Composer script to create Symfony parameters for the Doctrine bundle by parsing the DATABASE_URL environment variable populated by the Heroku Postgres addon.

To use it, start by adding the script to your composer.json file:

// ...
    "scripts": {
        "pre-install-cmd": [
          "Dunglas\\Heroku\\Database::createParameters"
        ],
        // ...
    }

Thanks to the ability of the Symfony Dependency Injection Component to read parameters from special environment variables, the parameters are automatically populated.

Change the content of the app/config/services.yml like the following to use them:

doctrine:
    dbal:
        driver:   "pdo_pgsql"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8

In your local development environment, don't forget to set the SYMFONY__DATABASE_URL environment variable. A typical value for that variable is `postgres://user:pass@server:5432/dbname.

A convenient way to manage environment variable is the PHP dotenv library.

Credits

This library is part of the API Platform project. Created by Kévin Dunglas.

Our Mission

We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.

Interesting Articles

Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated

p-e622a1a2