Releases: kasapdev/php-env-validator
Releases · kasapdev/php-env-validator
Release list
v1.2.0
Added
EnvValidator::generateExampleFile(): string— generates a.env.example-shaped string directly from a validator's declared rules, so the example file can never drift from whatvalidate()actually enforces. For each declared key it emits a#comment describing the rule's type, required/optional status, default value (if any), and allowed-values constraint (if any), followed by aKEY=valueline, prefilled with the default when one is declared and left blank otherwise. The generatedKEY=valuelines are ordinary.envsyntax and round-trip through the existingEnvFileLoader::loadEnvFile()unchanged, with no modifications required to that method.- New test coverage in
tests/run.phpthat builds a realistic rule set (a required string, an optional int with a default, and a string constrained byin()), generates an example file from it, parses that file back withloadEnvFile(), and asserts every declared key is present in the parsed result. - README: a new "Generating a .env.example File" section with a runnable example, plus an additional end-to-end "A full boot-time example" under Usage.
See CHANGELOG.md for details.
v1.1.0
Adds edge-case regression tests: array casting with consecutive/trailing commas, case-insensitive bool casting, non-string raw env values, default() bypassing in(), and EnvFileLoader edge cases (multi-equals values, empty keys, unterminated quotes). No behavioral changes; all tests pass.