Download the PHP package grazulex/laravel-configrypt without Composer
On this page you can find all versions of the php package grazulex/laravel-configrypt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download grazulex/laravel-configrypt
More information about grazulex/laravel-configrypt
Files in grazulex/laravel-configrypt
Package laravel-configrypt
Short Description Encrypt sensitive values in your Laravel .env file and decrypt them automatically at runtime โ safe, seamless, and config-driven.
License MIT
Homepage https://github.com/grazulex/laravel-configrypt
Informations about the package laravel-configrypt
Laravel Configrypt
Encrypt sensitive values in your Laravel .env file and decrypt them using helper functions that work around Laravel's environment caching limitations.
๐ Overview
๐ Laravel Configrypt lets you encrypt secrets directly in your .env file using a secure key, and decrypt them using reliable helper functions that work around Laravel's environment caching limitations.
It protects values like API tokens, database credentials, or secret keys โ especially when sharing .env files across environments or storing encrypted configs in source control or CI/CD.
โจ Features
- ๐ Encrypt
.envvalues using AES-256 - ๐ Reliable decryption with helper functions
- ๐ง Seamless Laravel integration via service provider
- ๐ Custom encryption key support (fallback to
APP_KEY) - ๐ก๏ธ Secure by default: decryption only happens inside app runtime
- โ๏ธ Configurable via
config/configrypt.php - ๐งช Safe for CI/CD, secrets rotation, and external vault injection
๐ก Example
In your .env:
In your Laravel code:
โ๏ธ Configuration
Publish the config:
Result in config/configrypt.php:
๐ Quick Start
1. Install the package
2. Publish configuration (optional)
3. Encrypt your secrets
Output:
4. Add to your .env file
5. Use in your application
โ ๏ธ Important: Laravel's env() function cannot be automatically decrypted due to early caching.
โ ๏ธ Important: Laravel env() Cache Limitation
Laravel caches environment variables very early in the boot process, before service providers load. This means the standard env() function cannot be automatically decrypted.
๐ง Solution: Use Helper Functions
๐ Quick Migration
Find and replace in your codebase:
๐ง Advanced Usage
Using the Facades
Helper Functions
Dependency Injection
๐งช Practical Examples
Database Configuration
API Keys Management
Multi-Environment Setup
More examples are available in the Examples Wiki.
๐ Changing Keys
You can define a custom CONFIGRYPT_KEY in .env to use a dedicated encryption key different from APP_KEY.
๐ก Remember: only encrypted values with the correct key can be decrypted. Keep your key safe!
๐ก๏ธ Security Considerations
- Environment Variable Safety: Decrypted values never touch disk after load, only stored in runtime memory
- Prefix Protection:
ENC:prefix ensures only intended values are decrypted - Error Handling: Graceful fallbacks prevent application crashes from decryption failures
- Key Management: Only encrypted values with the correct key can be decrypted - keep your key safe!
- Production Usage: Ideal for
.env.staging,.env.production, or vault-managed.envoverrides - Team Sharing: Perfect for sharing
.envsecurely in teams or across pipelines
๐ Documentation
Comprehensive documentation and examples are available in the GitHub Wiki:
- Installation Guide - Getting started with Laravel Configrypt
- Configuration - Customizing encryption settings
- Basic Usage - Fundamental encryption/decryption operations
- Advanced Usage - Complex scenarios and integrations
- Artisan Commands - Command-line tools reference
- API Reference - Complete API documentation
- Security Considerations - Security best practices
- Troubleshooting - Common issues and solutions
- Examples - Practical usage examples
๐ License
MIT License โ see LICENSE.md
All versions of laravel-configrypt with dependencies
illuminate/support Version ^12.19
illuminate/console Version ^12.19
illuminate/encryption Version ^12.19