PHPackages                             izica/laravel-env-secure - 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. izica/laravel-env-secure

ActiveLibrary[Security](/categories/security)

izica/laravel-env-secure
========================

Secure Laravel .env variables

1.13(2y ago)0192↓75%MITPHPPHP ^7.4|^8.0

Since Apr 7Pushed 2y ago1 watchersCompare

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

READMEChangelog (10)DependenciesVersions (15)Used By (0)

Laravel env secure
==================

[](#laravel-env-secure)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fbe7c6fbe5de39b35f3e677535013694f6cd0a1ce38f644603a5a067ab77d586/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f697a6963612f6c61726176656c2d656e762d7365637572652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/izica/laravel-env-secure)

PRs are welcome

Description
-----------

[](#description)

Simple Laravel package with zero dependencies for securing your env values, such as database passwords or API keys, to prevent exposure($\_ENV or $\_SERVER) due to mistakes

Prerequisites
-------------

[](#prerequisites)

This package using

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

[](#installation)

You can install the package via composer:

```
composer require izica/laravel-env-secure
```

Publish config(optional)
------------------------

[](#publish-configoptional)

```
php artisan vendor:publish --provider="Izica\\EnvSecure\\EnvSecureServiceProvider"
```

Usage
-----

[](#usage)

#### 1. Encrypt env value

[](#1-encrypt-env-value)

```
php artisan env:secure {env key} {--cli} {--decrypt}
```

Options:

- --cli - only print result in console don't rewrite .env
- --decrypt - decrypt env value

Example:

```
php artisan env:secure DB_PASSWORD
```

*Your env file will change*from:

```
DB_PASSWORD=somepassword
```

to:

```
DB_PASSWORD=scr::zvzEOZDAE4k/7D/rx
```

#### 2. Change config to

[](#2-change-config-to)

```
//config/database.php

use \Izica\EnvSecure\EnvSecure;

[
    //...
    'connections' => [
         //...
        'mysql' => [
            //...
            'password' => EnvSecure::env('DB_PASSWORD', ''),
        ]
    ]
]
```

Config
------

[](#config)

```
//config env-secure.php
return [
    "prefix"    => env('ENV_SECURE_PREFIX', 'scr::'),
    "algorithm" => env('ENV_SECURE_ALGORITHM', 'AES-128-CTR'),  // https://www.php.net/manual/en/function.openssl-get-cipher-methods.php
    "iv"        => env('ENV_SECURE_IV', 1234567891011121),
    "key"       => env('ENV_SECURE_KEY', null), //APP_KEY by default. If you change the key after the values have been secured, you will not be able to decrypt the values in the future.
];
```

#### Security recommendations

[](#security-recommendations)

Set the key directly in the file, like:

```
//config env-secure.php
return [
   //...
    "key" => "kovdj43ksadjl32jlk"
];
```

Credits
-------

[](#credits)

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

License
-------

[](#license)

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

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Every ~0 days

Total

14

Last Release

764d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d4a3945b13adc2ef1e9d7ef3a41c66e28706ae3229b85fc3696114eea990a46?d=identicon)[izica](/maintainers/izica)

---

Top Contributors

[![izica](https://avatars.githubusercontent.com/u/13401922?v=4)](https://github.com/izica "izica (16 commits)")

---

Tags

decryptionecnryptenvenvironmentenvironment-variableslaravellaravel-frameworksafe-settingssafetysecuresecure-codingsecurityzero-dependencylaravelenvsecurelaravel-envizicalaravel-env-secure

### Embed Badge

![Health badge](/badges/izica-laravel-env-secure/health.svg)

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

###  Alternatives

[msztorc/laravel-env

Laravel env helper commands

7855.4k](/packages/msztorc-laravel-env)[irfa/php-sn-generator

"Serial number generator for web aplication"

194.9k1](/packages/irfa-php-sn-generator)[tamer-dev/laravel-env-cli

laravel commands to work with .env file in cli

126.5k](/packages/tamer-dev-laravel-env-cli)

PHPackages © 2026

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