Skip to content

Releases: cleaniquecoders/php-env-key-manager

v1.0.0

11 Nov 02:16
Compare
Choose a tag to compare

Release v1.0.0 - cleaniquecoders/php-env-key-manager

Full Changelog: https://github.com/cleaniquecoders/php-env-key-manager/commits/v1.0.0

We are excited to announce the initial release of cleaniquecoders/php-env-key-manager! This package provides a framework-agnostic solution for managing environment variables directly in .env files. Designed for flexibility and simplicity, it allows developers to easily set, disable, and enable environment keys across any PHP application, with specific integrations for Laravel, Symfony, and CodeIgniter.

Key Features

  • Set Key-Value Pairs: Add or update environment keys in the .env file using setKey.
  • Enable Keys: Activate an environment key by uncommenting it in the .env file.
  • Disable Keys: Deactivate an environment key by commenting it out in the .env file.
  • Framework Agnostic: Usable in any PHP project with minimal configuration.
  • Framework-Specific Integrations:
    • Laravel: Register as a singleton in AppServiceProvider for easy use across the application.
    • Symfony: Utilize EnvKeyManager in Symfony console commands and services.
    • CodeIgniter: Easily manage .env keys within controllers and custom classes.

Usage

Basic Usage

use CleaniqueCoders\PhpEnvKeyManager\EnvKeyManager;

$envFilePath = __DIR__ . '/.env';
$envManager = new EnvKeyManager($envFilePath);

// Set a key
$envManager->setKey('APP_DEBUG', 'true');

// Disable a key
$envManager->disableKey('APP_DEBUG');

// Enable a key
$envManager->enableKey('APP_DEBUG');

Installation

Install via Composer:

composer require cleaniquecoders/php-env-key-manager

Documentation

For complete usage instructions, refer to the README.


We look forward to your feedback on this initial release!