PHPackages                             kitteam/laravel-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. kitteam/laravel-dotenv

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

kitteam/laravel-dotenv
======================

set or add key value in .env file

2.1.4(6y ago)014MITPHPPHP &gt;=7.2

Since Oct 23Pushed 6y agoCompare

[ Source](https://github.com/kitteam/laravel-dotenv)[ Packagist](https://packagist.org/packages/kitteam/laravel-dotenv)[ RSS](/packages/kitteam-laravel-dotenv/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (4)Versions (16)Used By (0)

laravel-dotenv
==============

[](#laravel-dotenv)

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

[](#installation)

```
composer require kitteam/laravel-dotenv
```

Usage In Code
-------------

[](#usage-in-code)

**Facade**

```
\DotEnv::copy('.env.example') // is equels \DotEnv::copy('.env.example','.env');
\DotEnv::load('.env.example') // Not copy, just load '.env.example'

\DotEnv::set('APP_NAME','MY_APP_NAME');
\DotEnv::getOldValue(); //Laravel
\DotEnv::get('APP_NAME'); //MY_APP_NAME
\DotEnv::delete('APP_NAME');
```

**Instance**

```
$dotEnv= (new DotEnv('.env'))->copy('.env.example')) // copy .env.example->.env. if already exist, backup to .env.temp
$dotEnv->copy('.env.prod') // copy .env.prod -> .env. if already exist, backup to .env.temp
$dotEnv->load('.env.dev') //load .env.dev. if not exist, create empty file.

$dotEnv->set('APP_NAME', 'name')
$dotEnv->get('APP_NAME') //name
$dotEnv->delete('APP_NAME')
```

#### As alias

[](#as-alias)

```
$devDotEnv = new DotEnv('dev'); // is equels new DotEnv('.env.dev');
\DotEnv::copy('dev'); //is equels \DotEnv::copy('.env.dev')
```

Usage In Console
----------------

[](#usage-in-console)

```
php artisan env:copy prod // if exist .env, Can be skipped.
php artisan env:set APP_NAME MY_APP_NAME  //default is .env
php artisan env:get APP_NAME //MY_APP_NAME
php artisan env:delete APP_NAME //APP_NAME=MY_APP_NAME
```

#### Can set another file with --env argument in console

[](#can-set-another-file-with---env-argument-in-console)

```
php artisan env:set APP_NAME MY_APP_NAME --env=.env.prod
php artisan env:get APP_NAME --env=.env.prod //MY_APP_NAME
php artisan env:delete APP_NAME --env=.env.prod
```

Also you can alias like --env=prod

Testing
-------

[](#testing)

```
composer test
```

Inspiration
-----------

[](#inspiration)

Inspiration for this package came from [imliam's laravel-env-set-command](https://github.com/imliam/laravel-env-set-command). (This package is not managed at time of writing.)

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

[](#contributing)

All contributions (pull requests, issues and feature requests) are welcome. Make sure to read through the [CONTRIBUTING.md](CONTRIBUTING.md) first, though. See the [contributors page](../../graphs/contributors) for all contributors.

License
-------

[](#license)

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

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 97% 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 ~15 days

Recently: every ~52 days

Total

15

Last Release

2234d ago

Major Versions

0.4 → 1.02019-10-24

1.2 → 2.02019-10-24

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3116545?v=4)[kit-team](/maintainers/kit-team)[@kit-team](https://github.com/kit-team)

---

Top Contributors

[![santutu](https://avatars.githubusercontent.com/u/28470293?v=4)](https://github.com/santutu "santutu (32 commits)")[![sleuthhound](https://avatars.githubusercontent.com/u/1821565?v=4)](https://github.com/sleuthhound "sleuthhound (1 commits)")

---

Tags

laravelsetenvdotenv

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kitteam-laravel-dotenv/health.svg)

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

###  Alternatives

[firefly-iii/data-importer

Firefly III Data Import Tool.

8015.8k](/packages/firefly-iii-data-importer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k30](/packages/ronasit-laravel-helpers)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1320.9k4](/packages/team-nifty-gmbh-tall-datatables)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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