Skip to content

Releases: kasapdev/php-env-validator

v1.2.0

Choose a tag to compare

@kasapdev kasapdev released this 07 Sep 20:04

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 what validate() 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 a KEY=value line, prefilled with the default when one is declared and left blank otherwise. The generated KEY=value lines are ordinary .env syntax and round-trip through the existing EnvFileLoader::loadEnvFile() unchanged, with no modifications required to that method.
  • New test coverage in tests/run.php that builds a realistic rule set (a required string, an optional int with a default, and a string constrained by in()), generates an example file from it, parses that file back with loadEnvFile(), 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

Choose a tag to compare

@kasapdev kasapdev released this 06 Sep 01:22

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.

v1.0.0

Choose a tag to compare

@kasapdev kasapdev released this 05 Sep 23:41

Initial stable release.