PHPackages                             pradeepdev001/laravel-environment-manager - 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. pradeepdev001/laravel-environment-manager

ActiveLibrary

pradeepdev001/laravel-environment-manager
=========================================

A secure, enterprise-grade Laravel package to manage .env variables via a web UI and Artisan commands.

00PHPCI passing

Since Aug 5Pushed todayCompare

[ Source](https://github.com/pradeepdev001/laravel-environment-manager)[ Packagist](https://packagist.org/packages/pradeepdev001/laravel-environment-manager)[ RSS](/packages/pradeepdev001-laravel-environment-manager/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Environment Manager
===========================

[](#laravel-environment-manager)

[![Tests](https://github.com/pradeepdev001/laravel-environment-manager/actions/workflows/tests.yml/badge.svg)](https://github.com/pradeepdev001/laravel-environment-manager/actions/workflows/tests.yml)[![Static Analysis](https://github.com/pradeepdev001/laravel-environment-manager/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/pradeepdev001/laravel-environment-manager/actions/workflows/static-analysis.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/db3e519c4f7d46743d9844b521639b3e8f0ca961fab64ef966d8ce617255bb9e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f707261646565706465763030312f6c61726176656c2d656e7669726f6e6d656e742d6d616e616765722e737667)](https://packagist.org/packages/pradeepdev001/laravel-environment-manager)[![Total Downloads](https://camo.githubusercontent.com/0a1a9b4363c22df20263c44fbbb02c360125fe6093f90894dfbbbde421ab111f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f707261646565706465763030312f6c61726176656c2d656e7669726f6e6d656e742d6d616e616765722e737667)](https://packagist.org/packages/pradeepdev001/laravel-environment-manager)[![License](https://camo.githubusercontent.com/f7240591f97efedba03fc20a4365d4c21765c095e88a4aa4796998af006a8cae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f707261646565706465763030312f6c61726176656c2d656e7669726f6e6d656e742d6d616e616765722e737667)](LICENSE)

A secure, enterprise-grade Laravel package to manage `.env` variables through a web-based admin UI and Artisan commands. Built for teams who need visibility, control, and auditability over their application configuration.

---

Features
--------

[](#features)

- **Viewer** — browse all env variables grouped by category with search, filter, and sort
- **Editor** — add, update, delete, rename, and bulk edit variables with atomic file writes
- **Sensitive value masking** — auto-detects and masks `APP_KEY`, `*_PASSWORD`, `*_SECRET`, `STRIPE_*`, etc.
- **Validation** — built-in rules for `APP_URL`, `MAIL_PORT`, `DB_CONNECTION`, `CACHE_DRIVER`, and more
- **Backup &amp; restore** — automatic pre-change backups, manual backups, encrypted backups, restore from UI or CLI
- **Version history** — full audit trail of every change with user, IP, reason, and rollback support
- **Diff viewer** — compare any two snapshots side-by-side
- **Import / Export** — `.env`, JSON, and YAML formats with pre-import validation
- **Environment comparison** — compare Local, Staging, Production side-by-side
- **Cache management** — auto-runs `config:clear`, `config:cache`, etc. after every save, with local-safe defaults
- **REST API** — full CRUD API with Sanctum auth and rate limiting
- **Artisan commands** — `list`, `get`, `set`, `delete`, `backup`, `restore`, `compare`, `validate`
- **Role-based authorization** — Super Admin, Admin, Read Only with configurable permissions
- **Audit log** — records every action with user, IP, browser, and timestamp
- **Notifications** — Mail, Slack, Teams, and custom webhooks
- **Dark mode** — responsive Blade UI with OS-level dark mode support

---

Requirements
------------

[](#requirements)

DependencyVersionPHP^8.1Laravel^8.0 | ^9.0 | ^10.0 | ^11.0 | ^12.0---

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

[](#installation)

```
composer require pradeepdev001/laravel-environment-manager
```

Publish the config file:

```
php artisan vendor:publish --tag=environment-manager-config
```

Publish and run migrations:

```
php artisan vendor:publish --tag=environment-manager-migrations
php artisan migrate
```

---

Quick Start
-----------

[](#quick-start)

After installation, visit `/admin/env-manager` in your browser (requires authentication via the configured guard).

```
# List all variables
php artisan env-manager:list

# Set a variable
php artisan env-manager:set APP_NAME "My App" --reason="Rebranding"

# Get a variable
php artisan env-manager:get DB_CONNECTION

# Create a backup
php artisan env-manager:backup

# Validate the current .env
php artisan env-manager:validate
```

### Using the Facade

[](#using-the-facade)

```
use Pradeepdev\EnvironmentManager\Facades\EnvManager;

// Get all variables
$variables = EnvManager::all();

// Get a single variable
$var = EnvManager::get('APP_NAME');

// Set a variable (validates, backs up, records history)
EnvManager::set('APP_NAME', 'New Name', reason: 'Rebranding');

// Bulk update
EnvManager::bulkSet([
    'CACHE_DRIVER'     => 'redis',
    'QUEUE_CONNECTION' => 'redis',
], reason: 'Switch to Redis');

// Delete
EnvManager::delete('OLD_KEY');
```

---

Configuration
-------------

[](#configuration)

After publishing, edit `config/environment-manager.php`:

```
return [
    // Enable/disable web UI and REST API
    'enable_ui'  => true,
    'enable_api' => true,

    // Admin-first defaults
    'guard'            => 'admin',
    'route_prefix'     => 'admin/env-manager',
    'route_middleware' => null, // defaults to ['web', 'auth:admin']

    // Restrict to specific user IDs (null = all authenticated users)
    'allowed_users' => [1, 2],

    // Auto-backup before every change
    'backup_path'       => storage_path('env-backups'),
    'backup_retention'  => 20,
    'backup_encryption' => false,

    // Custom sensitivity patterns
    'masking_patterns' => ['MY_CUSTOM_*'],

    // Cache commands to run after save
    'run_cache_commands_in_local' => false,
    'cache_commands' => ['config:clear', 'config:cache'],

    // Notifications
    'notifications' => [
        'on_env_update' => true,
        'slack' => [
            'enabled'     => true,
            'webhook_url' => env('ENV_MANAGER_SLACK_WEBHOOK'),
        ],
    ],
];
```

See [`config/environment-manager.php`](config/environment-manager.php) for all available options.

---

REST API
--------

[](#rest-api)

All endpoints are under `/api/env-manager` and, by default, require the `admin` guard.

MethodEndpointDescriptionGET`/api/env-manager/env`List all variablesPOST`/api/env-manager/env`Create a variablePUT`/api/env-manager/env/{key}`Update a variableDELETE`/api/env-manager/env/{key}`Delete a variableGET`/api/env-manager/env/history`Version historyGET`/api/env-manager/env/backups`List backups---

Authorization
-------------

[](#authorization)

The package uses a role-based system out of the box.

PermissionSuper AdminAdminRead Onlyview-env✅✅✅edit-env✅✅❌delete-env✅✅❌backup-env✅✅❌restore-env✅✅❌reveal-secrets✅configurable❌Plug in your own permission system via the `authorization_callback` config key:

```
'authorization_callback' => function ($user, $permission) {
    return $user->hasPermissionTo($permission); // e.g. Spatie Permission
},
```

---

Testing
-------

[](#testing)

```
composer test
composer test-coverage
```

---

Security
--------

[](#security)

Sensitive values are **never** stored, logged, or returned in plaintext. See [SECURITY.md](SECURITY.md) for the responsible disclosure process.

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

21

—

LowBetter than 17% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 73.9% 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/94212000?v=4)[pradeepdev001](/maintainers/pradeepdev001)[@pradeepdev001](https://github.com/pradeepdev001)

---

Top Contributors

[![pradeepkays](https://avatars.githubusercontent.com/u/102803828?v=4)](https://github.com/pradeepkays "pradeepkays (17 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![pradeepdev001](https://avatars.githubusercontent.com/u/94212000?v=4)](https://github.com/pradeepdev001 "pradeepdev001 (3 commits)")

### Embed Badge

![Health badge](/badges/pradeepdev001-laravel-environment-manager/health.svg)

```
[![Health](https://phpackages.com/badges/pradeepdev001-laravel-environment-manager/health.svg)](https://phpackages.com/packages/pradeepdev001-laravel-environment-manager)
```

PHPackages © 2026

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