PHPackages                             brunty/laravel-environment - 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. [CLI &amp; Console](/categories/cli)
4. /
5. brunty/laravel-environment

AbandonedArchivedLibrary[CLI &amp; Console](/categories/cli)

brunty/laravel-environment
==========================

Generate and work with .env files from the command line via an artisan command within Laravel.

0.2.1(11y ago)633MITPHPPHP &gt;=5.4.0

Since Jul 6Pushed 11y ago1 watchersCompare

[ Source](https://github.com/Brunty/laravel-environment)[ Packagist](https://packagist.org/packages/brunty/laravel-environment)[ RSS](/packages/brunty-laravel-environment/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (6)Dependencies (6)Versions (6)Used By (0)

Setup and work with .env files in Laravel from the command line
===============================================================

[](#setup-and-work-with-env-files-in-laravel-from-the-command-line)

NOTE: This doesn't work with Laravel 5 since .env files were changed. This is for Laravel 4.X
---------------------------------------------------------------------------------------------

[](#note-this-doesnt-work-with-laravel-5-since-env-files-were-changed-this-is-for-laravel-4x)

[![Latest Stable Version](https://camo.githubusercontent.com/877290c4743c2555acbd1bb434b8447a557c9d18b260ac486466e35a6391fed7/68747470733a2f2f706f7365722e707567782e6f72672f6272756e74792f6c61726176656c2d656e7669726f6e6d656e742f762f737461626c652e737667)](https://packagist.org/packages/brunty/laravel-environment) [![Build Status](https://camo.githubusercontent.com/d5fc65697cf4c5ff661222126788884a0157736e9eb87627caf981d4bac80ef2/68747470733a2f2f7472617669732d63692e6f72672f4272756e74792f6c61726176656c2d656e7669726f6e6d656e742e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/Brunty/laravel-environment) [![Coverage Status](https://camo.githubusercontent.com/356b9e7d85f3820d9ae8e9e77105afc5589a2c6a7f5ded440becbc7945edcbf4/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f4272756e74792f6c61726176656c2d656e7669726f6e6d656e742f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/Brunty/laravel-environment?branch=master) [![License](https://camo.githubusercontent.com/0e3e6ea6dc805bb5ea6aadc45248a637fb4da3a16e1f3dbb43672563f7c32dee/68747470733a2f2f706f7365722e707567782e6f72672f6272756e74792f6c61726176656c2d656e7669726f6e6d656e742f6c6963656e73652e737667)](https://packagist.org/packages/brunty/laravel-environment)

Future features
---------------

[](#future-features)

- Allow for more config types for values - currently only strings are supported, I want to add support for constants, integers, booleans etc.

This Laravel 4 package gives you a way to setup and work with your environment files within Laravel from the command line.

- `env:configure`

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

[](#installation)

Install the package through Composer. Edit your project's `composer.json` file to require `brunty/laravel-environment`.

```
"require": {
	"brunty/laravel-environment": "0.*"
}

```

Next, update Composer from the Terminal:

```
composer update

```

Once this has completed, add the service provider to your service providers array in `app/config/app.php`

```
'Brunty\LaravelEnvironment\LaravelEnvironmentServiceProvider'

```

You should then be able to see the command within artisan

```
php artisan

```

Usage
-----

[](#usage)

- `php artisan env:configure`

Use the above command to setup and/or configure an environment file, it works with the optional `--env` flag to specify what environment the file should be for.

When using this command, it'll prompt you for the variable name first, then the value.

If you want to specify a multi-dimensional array of items, you can use dot notation:

```
db.host

```

With a value of `foo`

Would be put into the .env file under:

```
[
    'db'    =>  [
        'host'  =>  'foo'
    ]
]

```

The names you enter for your env variables will autocomplete with existing values you have in the file.

To finish setup, just hit enter without giving a name when the command prompts you for a name.

It'll then give you a table showing the values that will be written to the file and prompt you to confirm that you want to write these values.

Access environment variables
----------------------------

[](#access-environment-variables)

Previously, you *may* have accessed your environment variables with the `$_ENV` superglobal like so:

```
'key'   =>  $_ENV['ENV_VAR'],

```

This can cause undefined index errors if you don't have a file for your environment already setup (this package can create a file from blank if required) when using this way of accessing environment variables.

I would recommend that you reference your environment variables using:

```
'key'   =>  getenv('varname'),

```

Which will simply return false if the environment variable doesn't exist (any 'multi-dimensional' items can be access with dot notation in the same way you entered them)

Notes:
------

[](#notes)

- Using this command, you can over-write previous values, to do this, just give the same name as the existing value, and it'll over-write the old values as it merges the user input with any existing values.
- If using multi-dimensional arrays, you cannot specify both a value for an item, and have an array in that same item.
- This command assumes you're running it under a user who has permission to write files if needed (as well as create the file if it doesn't already exist)

### Example of an early version working

[](#example-of-an-early-version-working)

[![Example of an early version working](https://camo.githubusercontent.com/211b12680d72a3d766b1d417e9cd1396febeed9da1d039ec1a3a973e3128fd4b/687474703a2f2f692e696d6775722e636f6d2f6a49456144316a2e6a7067)](https://camo.githubusercontent.com/211b12680d72a3d766b1d417e9cd1396febeed9da1d039ec1a3a973e3128fd4b/687474703a2f2f692e696d6775722e636f6d2f6a49456144316a2e6a7067)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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 ~1 days

Total

6

Last Release

4320d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/40cdb90b0420d70582f27d22c873198f24f2704ee3f80227134a7180cf8cff51?d=identicon)[Brunty](/maintainers/Brunty)

---

Top Contributors

[![Brunty](https://avatars.githubusercontent.com/u/1573273?v=4)](https://github.com/Brunty "Brunty (50 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/brunty-laravel-environment/health.svg)

```
[![Health](https://phpackages.com/badges/brunty-laravel-environment/health.svg)](https://phpackages.com/packages/brunty-laravel-environment)
```

###  Alternatives

[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[nunomaduro/laravel-console-menu

Laravel Console Menu is an output method for your Laravel/Laravel Zero commands.

815412.0k48](/packages/nunomaduro-laravel-console-menu)[bestmomo/nice-artisan

Web interface for Laravel Artisan

215149.3k](/packages/bestmomo-nice-artisan)[statamic/cli

Statamic CLI Tool

7587.7k](/packages/statamic-cli)[mwguerra/web-terminal

A web-based terminal component for Filament/Laravel with command whitelisting and multiple connection types

251.1k](/packages/mwguerra-web-terminal)[sunaoka/laravel-facade-generator

Provide command line generation of facade layer files.

171.9k](/packages/sunaoka-laravel-facade-generator)

PHPackages © 2026

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