Search by

nowo-tech / runtime-env-bundle

HecFranco

Store selected application environment variables in the database (encrypted at rest via DoctrineEncryptBundle) with an admin CRUD UI. FrankenPHP worker-safe.

Package info

github.com/nowo-tech/RuntimeEnvBundle

Documentation

Type:symfony-bundle

pkg:composer/nowo-tech/runtime-env-bundle

Fund package maintenance!

HecFranco

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-09-17 04:22 UTC

This package is auto-updated.

Last update: 2026-09-17 07:19:30 UTC


README

CI Packagist Version Packagist Downloads License PHP Symfony Coverage

Found this useful? Install from Packagist · Give it a star on GitHub so more developers can find it.

Database-backed application environment variables with admin CRUD. Values are encrypted at rest with nowo-tech/doctrine-encrypt-bundle. Designed for FrankenPHP worker (no $_ENV / putenv mutation; in-memory cache cleared via ResetInterface).

FrankenPHP Friendly Worker Mode

This bundle is FrankenPHP worker mode friendly.

Bootstrap secrets (DATABASE_URL, APP_SECRET, encryptor key files, FRANKENPHP_MODE, …) stay in .env. This bundle is for agility on business/integration variables you want to edit without redeploy.

Features

  • Doctrine entity RuntimeEnvVariable with #[Encrypted] value column
  • Admin CRUD at /_runtime_env (REQ-UI-002: ROLE_ADMIN by default)
  • RuntimeEnvBag API + Twig runtime_env('KEY') — worker-safe memoization + kernel.reset
  • Configurable table_prefix (default runtime_env → table runtime_env_variables)
  • UiKit-friendly markup (nowo-ui-*)

Requirements

  • PHP >= 8.2, < 8.6
  • Symfony 7.4, 8.0, or 8.1 (see composer.json; CI exercises 7.4, 8.0, and 8.1)
  • Doctrine ORM + Doctrine Bundle
  • nowo-tech/doctrine-encrypt-bundle (Halite recommended)
  • Twig 3.12+

Installation

composer require nowo-tech/runtime-env-bundle

Requires a configured DoctrineEncryptBundle profile (Halite recommended). See docs/INSTALLATION.md.

Register routes (Flex recipe copies this):

# config/routes/nowo_runtime_env.yaml
nowo_runtime_env:
    resource: .
    type: nowo_runtime_env

Configuration

# config/packages/nowo_runtime_env.yaml
nowo_runtime_env:
    enabled: true
    table_prefix: runtime_env
    panel:
        enabled: true
        path_prefix: /_runtime_env
    security:
        access_roles: [ROLE_ADMIN]
        allow_unauthenticated: false  # never true in production

Full tree: docs/CONFIGURATION.md.

Usage

use Nowo\RuntimeEnvBundle\Service\RuntimeEnvBag;

public function __construct(private RuntimeEnvBag $runtimeEnv) {}

public function __invoke(): void
{
    $token = $this->runtimeEnv->get('MY_API_TOKEN');
}
{{ runtime_env('MY_API_TOKEN') }}

See docs/USAGE.md for more examples.

Development

make setup-hooks
make up
make test
make phpstan
make cs-check

Demo: cd demo/symfony8 && make uphttp://localhost:8026 — see demo/README.md.

Documentation

Tests and coverage

  • Tests: PHPUnit (PHP) under tests/Unit/
  • Coverage:
    • PHP: 100%
    • TS/JS: N/A
    • Python: N/A
  • Badge / CI: PHPUnit coverage job on PHP 8.2 + Symfony 7.4

License

MIT. See LICENSE.

Author

Nowo.tech · Héctor Franco Aceituno