PHPackages                             cswni/laravel-env-set-command - 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. cswni/laravel-env-set-command

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

cswni/laravel-env-set-command
=============================

Set a .env file variable from the command line

v1.4.0(3y ago)444.6k↑63.5%41MITPHPPHP ^7.3|^8.0|^8.1

Since Jul 13Pushed 2y agoCompare

[ Source](https://github.com/cswni/laravel-env-set-command)[ Packagist](https://packagist.org/packages/cswni/laravel-env-set-command)[ Docs](https://github.com/cswni/laravel-env-set-command)[ GitHub Sponsors](https://github.com/imliam)[ RSS](/packages/cswni-laravel-env-set-command/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (4)Versions (8)Used By (1)

Laravel `env:set` Command
=========================

[](#laravel-envset-command)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7984ebae22e1587e3499eb6cbc150a1efb770e9dc5cb23767c253be2c0ce4421/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696d6c69616d2f6c61726176656c2d656e762d7365742d636f6d6d616e642e737667)](https://packagist.org/packages/imliam/laravel-env-set-command)[![Total Downloads](https://camo.githubusercontent.com/4e872dfebaf41bb6aea4084b7282f7942ab11ed602f648c73949754dcade01de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696d6c69616d2f6c61726176656c2d656e762d7365742d636f6d6d616e642e737667)](https://packagist.org/packages/imliam/laravel-env-set-command)[![License](https://camo.githubusercontent.com/97b9cf41b62327d6ee05fa87e9654f0a79b75e9992b6f2cb68016c06dd9fe80c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f696d6c69616d2f6c61726176656c2d656e762d7365742d636f6d6d616e642e737667)](LICENSE.md)[![CI Status](https://github.com/imliam/laravel-env-set-command/workflows/Run%20Tests/badge.svg)](https://github.com/imliam/laravel-env-set-command/actions)

Set a .env file variable from the command line.

[![Example command output](./screenshot.png)](./screenshot.png)

- [Laravel `env:set` Command](#laravel-setenv-command)
    - [Installation](#installation)
    - [Usage](#usage)
    - [Changelog](#changelog)
    - [Contributing](#contributing)
        - [Security](#security)
    - [Credits](#credits)
    - [License](#license)

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

[](#installation)

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

```
composer require cswni/laravel-env-set-command:^1.0
```

Usage
-----

[](#usage)

When running the `env:set` artisan command, you must provide both a key and value as two arguments.

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

You can also set values with spaces by wrapping them in quotes.

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

The command will also create new environment variables if an existing one does not exist.

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

Instead of two arguments split by a space, you can also mimic the `.env` file format by supplying `KEY=VALUE`.

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

The command will do its best to stop any invalid inputs.

```
$ php artisan env:set @pp_n@me Laravel
# Invalid environment key @pp_n@me! Only use letters and underscores
```

You can specify the external `.env` file in the third optional argument.

```
$ php artisan env:set APP_NAME TestApp /var/www/my_own_env.env
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'TestApp'
```

Or in the second parameter if you use key=value syntax.

```
$ php artisan env:set APP_NAME=TestApp /var/www/my_own_env.env
# Environment variable with key 'APP_NAME' has been changed from 'Laravel' to 'TestApp'
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Liam Hammett](https://github.com/imliam)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~250 days

Total

7

Last Release

1230d ago

PHP version history (4 changes)v1.0.0PHP ^7.1

v1.2.0PHP ^7.3

v1.3.0PHP ^7.3|^8.0

v1.4.0PHP ^7.3|^8.0|^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0415537a74f94340a66fe825a0890758e5dc816ace241cba183c8128bfc9918e?d=identicon)[cswni](/maintainers/cswni)

---

Top Contributors

[![imliam](https://avatars.githubusercontent.com/u/4326337?v=4)](https://github.com/imliam "imliam (18 commits)")[![CaliforniaMountainSnake](https://avatars.githubusercontent.com/u/44233829?v=4)](https://github.com/CaliforniaMountainSnake "CaliforniaMountainSnake (9 commits)")[![cswni](https://avatars.githubusercontent.com/u/14812743?v=4)](https://github.com/cswni "cswni (4 commits)")[![jameslkingsley](https://avatars.githubusercontent.com/u/11015784?v=4)](https://github.com/jameslkingsley "jameslkingsley (3 commits)")[![ddavaham](https://avatars.githubusercontent.com/u/7141998?v=4)](https://github.com/ddavaham "ddavaham (2 commits)")[![rodelias-frete](https://avatars.githubusercontent.com/u/281798633?v=4)](https://github.com/rodelias-frete "rodelias-frete (1 commits)")[![Cannonb4ll](https://avatars.githubusercontent.com/u/3110750?v=4)](https://github.com/Cannonb4ll "Cannonb4ll (1 commits)")[![chapeupreto](https://avatars.githubusercontent.com/u/834048?v=4)](https://github.com/chapeupreto "chapeupreto (1 commits)")[![davidsneal](https://avatars.githubusercontent.com/u/6142131?v=4)](https://github.com/davidsneal "davidsneal (1 commits)")

---

Tags

artisanenvironmentenvvariablesimliamlaravel-env-set-command

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cswni-laravel-env-set-command/health.svg)

```
[![Health](https://phpackages.com/badges/cswni-laravel-env-set-command/health.svg)](https://phpackages.com/packages/cswni-laravel-env-set-command)
```

###  Alternatives

[imliam/laravel-env-set-command

Set a .env file variable from the command line

119359.7k10](/packages/imliam-laravel-env-set-command)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M200](/packages/laravel-ai)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

725173.2k14](/packages/tallstackui-tallstackui)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21111.6k](/packages/iazaran-smart-cache)

PHPackages © 2026

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