https://github.com/jordanpartridge/conduit-env-manager
Conduit component for env-manager functionality
https://github.com/jordanpartridge/conduit-env-manager
cli conduit conduit-component laravel laravel-zero php
Last synced: 2 months ago
JSON representation
Conduit component for env-manager functionality
- Host: GitHub
- URL: https://github.com/jordanpartridge/conduit-env-manager
- Owner: jordanpartridge
- License: mit
- Created: 2025-07-28T00:05:33.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-07-29T01:33:17.000Z (10 months ago)
- Last Synced: 2026-01-13T22:33:03.433Z (5 months ago)
- Topics: cli, conduit, conduit-component, laravel, laravel-zero, php
- Language: PHP
- Size: 11.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ง Conduit env-manager
Complete environment file management component for .env operations.
## โจ Features
- **env:init** - Smart .env initialization from templates
- **env:set** - Set environment variables with validation
- **env:get** - Retrieve variables with security filtering
- **env:backup** - Timestamped backup and restore system
### ๐ก๏ธ Security Features
- Auto-hides sensitive values (PASSWORD, SECRET, KEY, TOKEN, etc.)
- Input validation for environment variable names
- Safe file operations with error handling
### ๐ค Automation Ready
- `--json` flag for machine-readable output
- `--no-interaction` for CI/CD pipelines
- `--all` flag for bulk operations
- Consistent exit codes for scripting
## ๐ฆ Installation
```bash
# Via Conduit component system (recommended)
conduit components install env-manager
# Via Composer directly
composer require jordanpartridge/conduit-env-manager
```
## ๐ Usage
### Initialize Environment Files
```bash
# Initialize .env from .env.example
conduit env:init
# Force overwrite existing .env
conduit env:init --force
# Create template if .env.example missing
conduit env:init # Will prompt to create template
```
### Set Environment Variables
```bash
# Set a variable
conduit env:set APP_NAME "My Application"
# Set with prompts
conduit env:set
# Create .env if it doesn't exist
conduit env:set API_KEY secret123 --create
```
### Get Environment Variables
```bash
# Get specific variable
conduit env:get APP_NAME
# List all variables (sensitive values hidden)
conduit env:get --all
# JSON output for scripts
conduit env:get --all --json
# Get specific variable as JSON
conduit env:get API_KEY --json
```
### Backup and Restore
```bash
# Create timestamped backup
conduit env:backup
# Create named backup
conduit env:backup --name before-deploy
# Restore from backup (interactive)
conduit env:backup --restore
```
## ๐๏ธ Architecture
This component follows Conduit standards:
- **Laravel Zero commands** with proper validation
- **Service provider auto-discovery** for seamless integration
- **Component metadata** in composer.json for discovery
- **Secure by default** with comprehensive error handling
## ๐งช Development
```bash
# Install dependencies
composer install
# Run tests
./vendor/bin/pest
# Code formatting
./vendor/bin/pint
# Static analysis
./vendor/bin/phpstan analyze
# All quality checks
composer lint && composer analyze && composer test
```
## ๐ Examples
### Complete Workflow
```bash
# Start new project
cd my-project
conduit env:init
# Configure environment
conduit env:set APP_NAME "My Project"
conduit env:set DB_DATABASE my_project_db
conduit env:set API_SECRET $(openssl rand -base64 32)
# Backup before changes
conduit env:backup --name initial-setup
# Verify configuration
conduit env:get --all
```
### CI/CD Integration
```bash
# Non-interactive setup
conduit env:init --force --no-interaction
conduit env:set NODE_ENV production --no-interaction
# JSON output for parsing
API_KEY=$(conduit env:get API_KEY --json | jq -r '.API_KEY')
```
## ๐ Command Reference
| Command | Description | Flags |
|---------|-------------|-------|
| `env:init` | Initialize .env file | `--force` |
| `env:set` | Set variables | `--create` |
| `env:get` | Get variables | `--all`, `--json` |
| `env:backup` | Backup/restore | `--name`, `--restore` |
## ๐ท๏ธ Keywords
`conduit`, `laravel`, `cli`, `component`, `conduit-component`, `environment`, `dotenv`, `configuration`
## ๐ License
MIT License. See [LICENSE](LICENSE) for details.