PHPackages                             tobymaxham/laravel-envcrypter - 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. [Security](/categories/security)
4. /
5. tobymaxham/laravel-envcrypter

ActiveLibrary[Security](/categories/security)

tobymaxham/laravel-envcrypter
=============================

This package can be used to encrypt and decrypt your .env file.

v1.0(4y ago)1257MITPHP

Since Apr 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/TobyMaxham/laravel-envcrypter)[ Packagist](https://packagist.org/packages/tobymaxham/laravel-envcrypter)[ Docs](https://github.com/TobyMaxham/laravel-envcrypter)[ RSS](/packages/tobymaxham-laravel-envcrypter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

TobyMaxham Laravel EnvCrypter
=============================

[](#tobymaxham-laravel-envcrypter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/56c449ccb28c721e7c1338fdfe8b56bf53f60326e4d9c435ead62cff973ba2b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f62796d617868616d2f6c61726176656c2d656e76637279707465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tobymaxham/laravel-envcrypter)[![Total Downloads](https://camo.githubusercontent.com/3bcc983b9f17b34b24d78579ce3305d839dbe2cfea588ac6790fd9281390296d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f62796d617868616d2f6c61726176656c2d656e76637279707465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tobymaxham/laravel-envcrypter)

This package can be used to encrypt and decrypt your `.env` file in any **Laravel** Application.

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

[](#installation)

You can install the package via composer:

```
composer require tobymaxham/laravel-envcrypter
```

Intro
-----

[](#intro)

In modern application we use the `.env` file to store sensitive data like Database-Credentials or API-Tokens in it. The benefit of that is, that none of them exists in your application source code and not in version-control.

But when it comes to share these credentials it's quite hard to share it in a secure way. So when you add some new environment variables you have to share them with your team-mates or need them at least to update it on your production server.

**That's where this package can help you.**

With this package you can store your `.env` file encrypted in your repository and add any information you made in a secure way and share them with your team-mates. When your local `.env` file needs to be updated, you can decrypt the file. Only the "Secret Token" will be needed to decrypt the file.

Usage
-----

[](#usage)

Lets assume you have a file `.env.repository` where you want to store all the variables of your local `.env` file. You can use the following code to encrypt all the variables and store it in the file you want to commit in your applications repository:

```
$crypter = new \TobyMaxham\LaravelEnvCrypter\EnvCrypter('Your-Secret-Token');

$content = $crypter->encryptFile('.env'); // encrypt the .env-File
file_put_contents('.env.repository', $content);
```

No you can commit your file and share it to your team-mates or upload it to your server.

When someone need to update the local `.env` file, just use the following code to decrypt the variables:

```
$crypter = new \TobyMaxham\LaravelEnvCrypter\EnvCrypter('Your-Secret-Token');

$content = $crypter->decryptFile('.env.repository'); // decrypt the file
file_put_contents('.env', $content); // update your local file
```

Also see the example file to use this package as very simple command-line tool for storing and loading your environment files.

Changelog
---------

[](#changelog)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Support me
----------

[](#support-me)

[![ko-fi](https://camo.githubusercontent.com/201ef269611db7eb6b5d08e9f756ab8980df3014b64492770bdf13a6ed924641/68747470733a2f2f6b6f2d66692e636f6d2f696d672f676974687562627574746f6e5f736d2e737667)](https://ko-fi.com/Z8Z4NZKU)

Credits
-------

[](#credits)

- [TobyMaxham](https://github.com/TobyMaxham)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

1495d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/900ab0a66bf701f3fb99a4db54276b4984cf3cf9b55ccad6df65c034f58be85f?d=identicon)[TobyMaxham](/maintainers/TobyMaxham)

---

Top Contributors

[![TobyMaxham](https://avatars.githubusercontent.com/u/5646469?v=4)](https://github.com/TobyMaxham "TobyMaxham (3 commits)")

---

Tags

laravelencryptdecrypttobymaxham

### Embed Badge

![Health badge](/badges/tobymaxham-laravel-envcrypter/health.svg)

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

###  Alternatives

[xxtea/xxtea

XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for PHP.

11341.7k](/packages/xxtea-xxtea)[miladrahimi/phpcrypt

Encryption, decryption, and hashing tools for PHP projects

3171.5k2](/packages/miladrahimi-phpcrypt)[hemiframe/php-aes

PHP class for encrypt and decrypt data with AES algorithm

1030.3k](/packages/hemiframe-php-aes)

PHPackages © 2026

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