PHPackages                             codegreencreative/laravel-heroku-deploy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. codegreencreative/laravel-heroku-deploy

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

codegreencreative/laravel-heroku-deploy
=======================================

Set up post deploy and pr pre destroy scripts for your Heroku review apps.

v1.1.0(3y ago)02701MITPHPPHP ^7.3CI failing

Since Sep 1Pushed 3y ago2 watchersCompare

[ Source](https://github.com/codegreencreative/laravel-heroku-deploy)[ Packagist](https://packagist.org/packages/codegreencreative/laravel-heroku-deploy)[ RSS](/packages/codegreencreative-laravel-heroku-deploy/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4533aad7b1a38b478acf6dd4a2f643c4a1ab435f00fc3c5d76c484b35adb9a6b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6465677265656e63726561746976652f6c61726176656c2d6865726f6b752d6465706c6f792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codegreencreative/laravel-heroku-deploy)[![Total Downloads](https://camo.githubusercontent.com/0c6b927261a186cf5f27a3c92abe52c9977f0b7fff2aedd66071490b686094ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6465677265656e63726561746976652f6c61726176656c2d6865726f6b752d6465706c6f792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codegreencreative/laravel-heroku-deploy)

Laravel Heroku Deploy
=====================

[](#laravel-heroku-deploy)

This Laravel 7+ package allows you to configure your Heroku Review Apps instance for Laravel applications. You can manage custom domains using Cloudflare, apply Automated Certificate Management (ACM) with Lets Encrypt and update Config Vars using Heroku's `postdeploy` and `pr-predestroy` script events.

Installation
------------

[](#installation)

Require this package with composer:

```
composer require codegreencreative/laravel-heroku-deploy
```

Configuration
=============

[](#configuration)

The command below will add a new heroku-deploy.php config file in your config folder.

```
php artisan vendor:publish --tag="heroky_deploy_config"
```

heroku-deploy.php
-----------------

[](#heroku-deployphp)

Sample heroku-deploy configuration file.

```
// config/heroku-deploy.php

return [
    // Heroku Platform API token, learn more here:
    // https://devcenter.heroku.com/articles/authentication
    'heroku_token' => env('HEROKU_DEPLOY_HEROKU_TOKEN', null),
    // Cloudflare token, get yours here:
    // https://dash.cloudflare.com/profile/api-tokens
    'cloudflare_token' => env('HEROKU_DEPLOY_CLOUDFLARE_TOKEN', null),
    // Created by Heroku, just capture the information
    'app_name' => env('HEROKU_APP_NAME', null),
    'pr_number' => env('HEROKU_PR_NUMBER', null),
    // JSON array containing information on your zones you want to use for this project
    // {
    //     "mydomain.com": ["id", "account", "support", "policies"]
    // }
    'cloudflare_zones' => json_decode(env('HEROKU_DEPLOY_ZONES', '[]'), true),
    // You can attach addons from other applications
    // {
    //      "addon_id": "confirming_app (id or name)"
    // }
    'heroku_addon_attachments' => json_decode(env('HEROKU_DEPLOY_ADDON_ATTACHMENTS', '[]'), true),
    // Enable automated certificate management in Heroku for each subdomain
    'enable_acm' => env('HEROKU_DEPLOY_ENABLE_ACM', true)
];
```

.env
----

[](#env)

Example .env entry.

```
HEROKU_DEPLOY_HEROKU_TOKEN=addyourtokenehere
HEROKU_DEPLOY_CLOUDFLARE_TOKEN=addyourtokenehere
HEROKU_DEPLOY_ZONES="{\"mydomain.com\": [\"id\", \"account\", \"support\"]}"
# Optional
# This connects Heroku Postgres database or Heroku Redis, for example
HEROKU_DEPLOY_ADDON_ATTACHMENTS="{\"xxxx-xxxx-xxxx-xxxx-xxxx\": \"xxxxxxxxx\"}"
HEROKU_DEPLOY_ENABLE_ACM=false

```

app.json
--------

[](#appjson)

Add the `postdeploy` and `pr-predestroy` commands to your app.json file.

```
{
    "environments": {
        "review": {
            "scripts": {
                "postdeploy": "php artisan heroku:postdeploy",
                "pr-predestroy": "php artisan heroku:pr-predestroy"
            }
        }
    }
}
```

Config Vars
-----------

[](#config-vars)

Two additional config vars are added/updated depending on your own configuration, `APP_BASE_DOMAIN` and `APP_URL`. The *first* domain you define in `HEROKU_DEPLOY_ZONES` will be considered your **base/primary domain** as you can only have one. The first subdomain of your first domain is considered your `APP_URL`. We also use the pull request number to keep review apps unique. Pull request numbers are provided by Heroku as environment variables.

For example, these will be added to your environment automatically:

```
APP_BASE_DOMAIN=pr-125.mydomain.com
APP_URL=https://id.pr-125.mydomain.com

```

Should you not enable ACM, session cookies will be set to insecure.

```
SESSION_SECURE_COOKIE=false

```

Session cookies will be created with a unique name.

```
SESSION_COOKIE=PR125_SID

```

Any other config vars that need to be added can be done so in your Heroku pipeline.

Bug Reporting
-------------

[](#bug-reporting)

If Bugsnag is installed, exceptions will be reported in Bugsnag.

Todo
----

[](#todo)

- Check logging config for errorlog | bugsnag
- Redirect default herokuapp.com subdomain to root domain

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~323 days

Total

3

Last Release

1430d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6f1e96bff18619cb3fd4904f9448dc59c681a8413fe3ff47e816506b99c7f0b?d=identicon)[codegreencreative](/maintainers/codegreencreative)

---

Top Contributors

[![upwebdesign](https://avatars.githubusercontent.com/u/1845130?v=4)](https://github.com/upwebdesign "upwebdesign (32 commits)")

---

Tags

laravelherokureview-appspostdeploypredestroy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codegreencreative-laravel-heroku-deploy/health.svg)

```
[![Health](https://phpackages.com/badges/codegreencreative-laravel-heroku-deploy/health.svg)](https://phpackages.com/packages/codegreencreative-laravel-heroku-deploy)
```

###  Alternatives

[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.4k10.6M272](/packages/laravel-boost)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[timokoerber/laravel-one-time-operations

Run operations once after deployment - just like you do it with migrations!

6481.7M11](/packages/timokoerber-laravel-one-time-operations)[laravel/cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

264778.4k3](/packages/laravel-cashier-paddle)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

4845.9k](/packages/sebdesign-laravel-viva-payments)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
