jardissupport / dotenv
Advanced functions dotEnv tool for reading .env files for standard global and protected contexts
Installs: 252
Dependents: 7
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/jardissupport/dotenv
Requires
- php: >=8.2
- jardisport/dotenv: ^1.0
Requires (Dev)
- phpstan/phpstan: ^2.0.4
- phpunit/phpunit: ^10.5
- squizlabs/php_codesniffer: ^3.11.2
This package is auto-updated.
Last update: 2026-02-25 17:32:00 UTC
README
Part of the Jardis Ecosystem — A modular DDD framework for PHP
A powerful environment configuration reader for PHP applications. Unlike traditional dotenv libraries, Jardis DotEnv supports protected contexts for domain-driven design — load different configurations for different bounded contexts without global state pollution.
Features
- Protected Contexts — Load configurations into isolated arrays instead of global
$_ENV - Automatic Type Casting — Converts strings to
bool,int,float, orarrayautomatically - Variable Substitution — Use
${VAR}syntax for dynamic value resolution - Modular Includes — Split configs with
load()andload?()directives - Include Cascade — Included files automatically resolve
.localand.{APP_ENV}variants - Environment-specific Loading — Auto-loads
.env.{APP_ENV}and.env.localfiles - Circular Reference Detection — Prevents infinite loops in include chains
- Custom Exception Hierarchy — Typed exceptions for missing files, unreadable files, parse errors, and circular includes
- Home Directory Expansion — Automatically expands
~to user home path
Installation
composer require jardissupport/dotenv
Quick Start
use JardisSupport\DotEnv\DotEnv; $dotEnv = new DotEnv(); // Load into global scope ($_ENV, $_SERVER, putenv) $dotEnv->loadPublic('/path/to/app'); // Load into protected scope (returns array, no global pollution) $domainConfig = $dotEnv->loadPrivate('/path/to/domain');
Documentation
Full documentation, examples and API reference:
→ jardis.io/docs/support/dotenv
Jardis Ecosystem
This package is part of the Jardis Ecosystem — a collection of modular, high-quality PHP packages designed for Domain-Driven Design.
| Category | Packages |
|---|---|
| Core | Kernel, Entity, Workflow |
| Support | DotEnv, Cache, Logger, Messaging, DbConnection, DbQuery, DbSchema, Validation, Factory, ClassVersion |
| Generic | Auth |
| Tools | Builder, Migration, Faker |
License
This package is licensed under the PolyForm Noncommercial License 1.0.0.
For commercial use, see COMMERCIAL.md.