PHPackages                             tamer-dev/laravel-env-cli - 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. tamer-dev/laravel-env-cli

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

tamer-dev/laravel-env-cli
=========================

laravel commands to work with .env file in cli

1.2.0(3y ago)126.5k↓25%4[1 issues](https://github.com/tamer-dev/laravel-env-cli/issues)MITPHPPHP ^7.1|^8.0|^8.1

Since May 17Pushed 3y ago2 watchersCompare

[ Source](https://github.com/tamer-dev/laravel-env-cli)[ Packagist](https://packagist.org/packages/tamer-dev/laravel-env-cli)[ Docs](https://github.com/tamer-dev/laravel-env-cli)[ RSS](/packages/tamer-dev-laravel-env-cli/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Commands for .env file
==============================

[](#laravel-commands-for-env-file)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0bbbec657665c1ca537c9a90ec672c78079a08a4274e338f69adc99735228486/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74616d65722d6465762f6c61726176656c2d656e762d636c692e737667)](https://packagist.org/packages/tamer-dev/laravel-env-cli)[![Total Downloads](https://camo.githubusercontent.com/ef14d260138bb6e130666a50e4d2f5713ac5b79110bba5cd1cf8889ae77f89d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74616d65722d6465762f6c61726176656c2d656e762d636c692e737667)](https://packagist.org/packages/tamer-dev/laravel-env-cli)[![License](https://camo.githubusercontent.com/5c52e7efe68b132b80c229d61df0246eae296d3dc31acdfad1430b3c1032abcc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f74616d65722d6465762f6c61726176656c2d656e762d636c692e737667)](LICENSE.md)

This Laravel package offers to you some commands to work with your env file from the command line. if you are making changes frequently to your env file this package will help you to do this fast and in an effective way.

This package supports the Laravel version from 5.7 to 10 .

- [Installation](#installation)
- [Usage:-](#usage)
    - [Set Environment Variable Command](#1-set-environment-variable-command)
    - [Read Environment Variable Command](#2-read-environment-variable-command)
    - [Backup Environment File Command](#3-backup-environment-file-command)
    - [Restore Environment File Command](#4-restore-environment-file-command)
- [Contribution](#contribution)
- [Notes](#notes)
- [License](#license)

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

[](#installation)

You can install this package with [Composer](https://getcomposer.org/) using the following command:

```
composer require tamer-dev/laravel-env-cli
```

Usage
-----

[](#usage)

#### 1- Set Environment Variable Command

[](#1--set-environment-variable-command)

command definition :- `env:set {key} {value}`

this command by default will use .env file

optional command options:- `{--file=your-custom-env-name}` if you want to set a key in custom env file

`{--b|backup}` take a backup from env file before set the key

you must provide both a key and value .

```
$ php artisan env:set app_name Example
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'Example'
```

you can provide them as two arguments as commnd before or one argument like follwoing:- .

```
$ php artisan env:set app_name=Example
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'Example'
```

if you value have spaces you can wrapping them in quotes like follwoing:-.

```
$ php artisan env:set app_name "Example App"
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to '"Example App"'
```

you can create new environment variables if this key dose not exist.

```
$ php artisan env:set editor=vscode
# Environment variable with key 'EDITOR' has been set to 'vscode'
```

you can create or update environment variables in another file not in the default one by passing --file option like following:-

```
$ php artisan env:set app_name Example --file=.env.example
# Environment variable with key 'EDITOR' has been set to 'vscode'
```

also you can take a backup file from your env file before make any changes in same command by passing -b option (a new file backup with the name '.env.backup\_&lt;current\_date\_time&gt;' will be created) like following:-

```
$ php artisan env:set app_name Example -b
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'Example'
```

another features :-

- update an empty value
- stop invalid inputs
- stop updateing in APP\_KEY

#### 2- Read Environment Variable Command

[](#2--read-environment-variable-command)

command definition :- `env:read {key}`this command by default will use .env file

```
$ php artisan env:read app_name
# Environment variable with key [APP_NAME] have value [Laravel] file used is .env
```

optional command options:- `{--file=your-custom-env-name}` if you want to read a key from a custom env file

```
$ php artisan env:read app_name --file=.env.example
#Environment variable with key [APP_NAME] have value [tamertest3] file used is .env.example
```

#### 3- Backup Environment File Command

[](#3--backup-environment-file-command)

this command will make a backup from env file (a new file backup with the name '.env.backup\_&lt;current\_date\_time&gt;' will be created)

command definition :- `env:backup`this command by default will use .env file

```
$ php artisan env:backup
#new environment backup file has been created in this path '/var/www/html/laravel-env-cli/.env.backup_20200517204848'
```

optional command options:- `{--file=your-custom-env-name}` if you want to backup a custom env file

```
$ php artisan env:backup --file=.env.example
#new environment backup file has been created in this path '/var/www/html/laravel-env-cli/.env.example.backup_20200517205000'
```

#### 4- Restore Environment File Command

[](#4--restore-environment-file-command)

restore your .env file from a backup file

command definition :- `env:restore {backupedFileName}`this command by default will use .env file

```
$ php artisan env:restore .env.backup_20200517204848
#the env file '/var/www/html/laravel-env-cli/.env'
#has been restored from this file path '/var/www/html/laravel-env-cli/.env.backup_20200517204848'
```

optional command options:- `{--file=your-custom-env-name}` if you want to restore a custom env file

```
$ php artisan env:restore .env.backup_20200517204848 --file=.env.example
#the env file '/var/www/html/laravel-env-cli/.env.example'
#has been restored from this file path '/var/www/html/laravel-env-cli/.env.backup_20200517204848'
```

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Contribution
------------

[](#contribution)

contribution are welcome ,if any one want to contribute in this package you can start by picking from this list : -

- add tests
- add more commands and important features
- fix any issues

Notes
-----

[](#notes)

this package inspired by this package [imliam/laravel-env-set-command](https://github.com/imliam/laravel-env-set-command),for that all thanks to [imliam](https://github.com/imliam)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

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

Total

3

Last Release

1130d ago

PHP version history (3 changes)1.0.0PHP ^7.1

1.1.0PHP ^7.1|^8.0

1.2.0PHP ^7.1|^8.0|^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e2b933ffc875ea85f4edc2c72148129e5b1ebbeafe6a0977e96ff13d0317127?d=identicon)[tamerdev](/maintainers/tamerdev)

---

Top Contributors

[![tamer-dev](https://avatars.githubusercontent.com/u/434489?v=4)](https://github.com/tamer-dev "tamer-dev (15 commits)")

---

Tags

envlaravellaravel-packagelaravelartisanenvironmentenvvariableslaravel-envlaravel-env-settamer-devlaravel-env-commandslaravel-env-read

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tamer-dev-laravel-env-cli/health.svg)

```
[![Health](https://phpackages.com/badges/tamer-dev-laravel-env-cli/health.svg)](https://phpackages.com/packages/tamer-dev-laravel-env-cli)
```

###  Alternatives

[msztorc/laravel-env

Laravel env helper commands

7855.4k](/packages/msztorc-laravel-env)[nunomaduro/laravel-console-menu

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

815412.0k48](/packages/nunomaduro-laravel-console-menu)[sven/flex-env

Edit your .env file in Laravel directly from the command line.

10297.2k](/packages/sven-flex-env)[imliam/laravel-env-set-command

Set a .env file variable from the command line

118352.4k10](/packages/imliam-laravel-env-set-command)[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)
