PHPackages                             dejury/laravel-envcrypt - 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. dejury/laravel-envcrypt

ActiveLibrary

dejury/laravel-envcrypt
=======================

This package will help you to keep different .env files within your version management. Of course, it is possible to encrypt the files so they can be safely pushed to your version control.

v1.0.0(5y ago)04MITPHPPHP &gt;=7.2.5

Since Aug 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/dejury/laravel-envcrypt)[ Packagist](https://packagist.org/packages/dejury/laravel-envcrypt)[ Docs](https://github.com/dejury/envcrypt)[ RSS](/packages/dejury-laravel-envcrypt/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (3)Used By (0)

Laravel Envcrypt: secured env variables for multiple environments
=================================================================

[](#laravel-envcrypt-secured-env-variables-for-multiple-environments)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7067b275aa089221aa4507805e11c6baf388bec93b9be630580e42841f32d6a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64656a7572792f6c61726176656c2d656e7663727970743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dejury/envcrypt)[![Total Downloads](https://camo.githubusercontent.com/a4b175f6e70358115e9e105f1f79f62d2a465b8197c82a84b0d93e3654d1e8a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64656a7572792f6c61726176656c2d656e7663727970743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dejury/envcrypt)

This package gives you the possibility to store certain values you would normally store in your .env file in an encrypted file which can be part of your version control. It supports the storage for multiple environments and automatically loads the variables for the current environment. They will be available in the env() function.

Package inspired by:

[BeyondCode laravel-credentials](https://github.com/beyondcode/laravel-credentials)
[Stechstudio Laravel Env Security](https://github.com/stechstudio/laravel-env-security)

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

[](#installation)

You can install the package via composer:

```
composer require dejury/laravel-envcrypt
```

Copy the corresponding config file to your laravel directory by executing:

```
php artisan vendor:publish --provider="Dejury\Envcrypt\EnvcryptServiceProvider"
```

It is highly recommended to use another encryption key then the default application key. Also it is highly recommended that the encryption key is not stored in version control. You can set the available environments inside the config, this is for letting the application know which environments to save if you choose to save all environments.

By default the encrypted files are stored in the root of your laravel project, you can change this in the config.

Usage
-----

[](#usage)

```
php artisan envcrypt:add KEY_NAME
```

Will save OR edit the corresponding KEY\_NAME with the value that will be asked during execution of the command. You can also set an environment or choose to store to all environments.

```
php artisan envcrypt:remove KEY_NAME
```

Will REMOVE the corresponding KEY\_NAME. You can also set an environment or choose to remove to all environments.

```
php artisan envcrypt:view ENVIRONMENT
```

See all the stored values for that ENVIRONMENT. Will show in JSON format.

```
$encryptedEnv = env('KEY_NAME'); // just like you are used to in Laravel
```

### Testing

[](#testing)

```
composer test
```

### Is this package secure?

[](#is-this-package-secure)

The goal of this package is to store certain ENV vars encrypted. For example API\_KEYS. You can safely store them in version control and it will automatically be available on the server where it is deployed.
This makes it easier to deploy ENV vars through all of your different environments.

Of course: this package uses a key to encrypt and decrypt the data. The key should be stored securely, to prevent decryption by unwanted persons. Whenever somebody has access to the server it is always possible to see the decrypted values by using the artisan commands or to manually decrypt the files. This package is always better to use in version control then storing PLAIN values.

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information 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)

- [Jonathan Hafkamp](https://github.com/dejury)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Unknown

Total

1

Last Release

2104d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/84bfe6c95276cd48996191e1fe4989db99f86bbe5dfb2417eaa49e5283369783?d=identicon)[dejury](/maintainers/dejury)

---

Top Contributors

[![dejury](https://avatars.githubusercontent.com/u/16034333?v=4)](https://github.com/dejury "dejury (6 commits)")

---

Tags

dejuryenvcrypt

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dejury-laravel-envcrypt/health.svg)

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

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M529](/packages/laravel-passport)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[laravel/lumen-framework

The Laravel Lumen Framework.

1.5k26.2M708](/packages/laravel-lumen-framework)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[themosis/framework

The Themosis framework.

676307.9k18](/packages/themosis-framework)[laragear/webauthn

Authenticate users with Passkeys: fingerprints, patterns and biometric data.

403480.4k8](/packages/laragear-webauthn)

PHPackages © 2026

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