PHPackages                             dapasa/env-set - 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. dapasa/env-set

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

dapasa/env-set
==============

Set a .env file variable from the command line

098PHP

Since May 29Pushed 4y ago1 watchersCompare

[ Source](https://github.com/dapasa/env-set)[ Packagist](https://packagist.org/packages/dapasa/env-set)[ RSS](/packages/dapasa-env-set/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#laravel-envset-command)

[![Latest Version on Packagist](https://camo.githubusercontent.com/65c0a6cb1f4daa2e50b23ca0de45127b7a2aeed438a53f15e6bb47f9bbf83271/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6461706173612f656e762d7365742e737667)](https://packagist.org/packages/dapasa/env-set)[![Total Downloads](https://camo.githubusercontent.com/8b762f53a0215221e02ec7eb5cbd39f7f077a5097ddd8c806c4665e569dcf585/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6461706173612f656e762d7365742e737667)](https://packagist.org/packages/dapasa/env-set)[![License](https://camo.githubusercontent.com/ad1f0bfffaf979618d5fd7c3864cec836ecd108752a9440f45ba333b84f009d1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f696d6c69616d2f656e762d7365742e737667)](LICENSE.md)[![CI Status](https://github.com/dapasa/env-set/workflows/Run%20Tests/badge.svg)](https://github.com/dapasa/env-set/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 dapasa/env-set
```

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)

- [Daniel Passarelli](https://github.com/dapasa)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17165383?v=4)[Daniel Passarelli](/maintainers/dapasa)[@dapasa](https://github.com/dapasa)

---

Top Contributors

[![dapalam](https://avatars.githubusercontent.com/u/119694772?v=4)](https://github.com/dapalam "dapalam (5 commits)")

### Embed Badge

![Health badge](/badges/dapasa-env-set/health.svg)

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

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

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