tourze/env-manage-bundle

环境变量管理

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

0.0.4 2025-04-21 03:18 UTC

This package is auto-updated.

Last update: 2025-04-25 19:23:57 UTC


README

English | 中文

Latest Version Build Status Quality Score Total Downloads

A Symfony bundle for managing environment variables in the database, supporting runtime loading, synchronization, and auditing.

Features

  • Manage environment variables in database with full audit trail
  • Runtime loading of variables for HTTP, CLI, and worker contexts
  • Fine-grained control: enable/disable, sync control, remarks
  • Snowflake ID, user/IP/time tracking for all changes
  • Easy integration with Symfony events and Messenger
  • Extensible via admin interface attributes

Installation

Requirements

  • PHP >= 8.1
  • Symfony >= 6.4
  • Doctrine ORM >= 2.20

Install via Composer

composer require tourze/env-manage-bundle

Enable the Bundle

Usually auto-registered via Symfony Flex. If not, add to config/bundles.php:

Tourze\EnvManageBundle\EnvManageBundle::class => ['all' => true],

Quick Start

  1. Run database migrations for the base_env table (see entity design in ENTITY_DESIGN.md)
  2. Use the admin interface or Doctrine to add/edit environment variables
  3. On app start, HTTP request, CLI, or worker, variables are loaded and injected into $_ENV

Example: Fetching Public Variables

/** @var \Tourze\EnvManageBundle\Service\EnvService $service */
$vars = $service->fetchPublicArray();

Documentation

  • Entity Design
  • Workflow (Mermaid)
  • All variables are tracked for audit and can be filtered/synchronized as needed
  • See code for advanced extension points and admin attributes

Contribution Guide

  • Issues and PRs are welcome!
  • Follow PSR coding standards
  • Run tests and PHPStan before submitting

License

MIT License. Copyright (c) tourze

Changelog

See Releases for version history and upgrade notes.