PHPackages                             cba85/heroku-dotenv - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cba85/heroku-dotenv

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cba85/heroku-dotenv
===================

Copy php `.env` variables to or from Heroku environment variables

1.0.0(5y ago)5451MITPHPPHP &gt;=7.3

Since Feb 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/cba85/heroku-dotenv)[ Packagist](https://packagist.org/packages/cba85/heroku-dotenv)[ Docs](https://github.com/cba85/heroku-dotenv)[ RSS](/packages/cba85-heroku-dotenv/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Heroku Dotenv
=============

[](#heroku-dotenv)

⌨️ Copy php `.env` variables to or from [Heroku](https://www.heroku.com) environment variables.

Why creating this package?
--------------------------

[](#why-creating-this-package)

I've created this package because I often use PHP projects/frameworks that use [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv) package to handle PHP environment values in a `.env` file.

You can't create/modify files in your Heroku server using Heroku CLI (ok, in fact [you can](https://gist.github.com/btakita/7853541)), and you can't create your production `.env` file, so you have to manually create your environment variables using Heroku CLI or on your Heroku dashboard.

This PHP script can automatically copy environment variables in a .env file to and from Heroku.

Requirements
------------

[](#requirements)

### Heroku CLI

[](#heroku-cli)

This PHP script uses [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli). You must have installed it on your machine.

### Composer

[](#composer)

Make sure [Composer](https://getcomposer.org/download/) is installed globally.

Install
-------

[](#install)

```
$ composer global require cba85/heroku-dotenv
```

Then make sure you have the global Composer binaries directory in your PATH.

This directory is platform-dependent, see [Composer documentation](https://getcomposer.org/doc/03-cli.md#composer-home) for details.

### Update

[](#update)

```
$ composer global update cba85/heroku-dotenv
```

Usage
-----

[](#usage)

Go to your project folder that contains a `.env` file.

### Send .env file to Heroku environment

[](#send-env-file-to-heroku-environment)

```
$ heroku-dotenv push -a heroku_app_name
```

### Save Heroku environment to .env file

[](#save-heroku-environment-to-env-file)

```
$ heroku-dotenv pull heroku_app_name
```

Options
-------

[](#options)

### -f, --file

[](#-f---file)

Name or path of your project `.env` file.

```
$ heroku-dotenv push heroku_app_name -f .env.production
$ heroku-dotenv pull heroku_app_name -f .env.production
```

Tests
-----

[](#tests)

The package contains a dotenv file for testing, located in `example/` folder.

```
$ ./heroku-dotenv push heroku_app_name -f example/.env
$ ./heroku-dotenv pull heroku_app_name -f example/.env
```

> Where `heroku_app_name` is a valid Heroku app.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

1907d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f8dae5dac31d448b3ae83800c9c084dd576e2c5ef16b6313710048b2904c5db?d=identicon)[cba85](/maintainers/cba85)

---

Top Contributors

[![cba85](https://avatars.githubusercontent.com/u/720547?v=4)](https://github.com/cba85 "cba85 (6 commits)")

---

Tags

heroku-cliheroku-dotenvheroku-environment

### Embed Badge

![Health badge](/badges/cba85-heroku-dotenv/health.svg)

```
[![Health](https://phpackages.com/badges/cba85-heroku-dotenv/health.svg)](https://phpackages.com/packages/cba85-heroku-dotenv)
```

###  Alternatives

[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[phel-lang/phel-lang

Phel is a functional programming language that compiles to PHP

4743.5k10](/packages/phel-lang-phel-lang)[symfony/ai-bundle

Integration bundle for Symfony AI components

30282.3k6](/packages/symfony-ai-bundle)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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