Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new mako\env\DotenvLoader to load .env files into the runtime environment with optional variable interpolation and optional overriding of existing variables, along with unit tests and fixture .env files to validate parsing and error handling.
Changes:
- Added
DotenvLoaderimplementation and newEnvExceptiontype undermako\env. - Added unit tests plus fixture
.envfiles covering valid parsing, overrides, interpolation, and parse errors. - Documented the addition in
CHANGELOG.md.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/env/fixtures/unterminated-single-quote.env | Fixture for unterminated single-quoted value error handling. |
| tests/unit/env/fixtures/unterminated-double-quote.env | Fixture for unterminated double-quoted value error handling. |
| tests/unit/env/fixtures/undefined-variable.env | Fixture for undefined ${VAR} interpolation error handling. |
| tests/unit/env/fixtures/override.env | Fixture for duplicate key behavior with/without override enabled. |
| tests/unit/env/fixtures/invalid-key.env | Fixture for invalid key validation. |
| tests/unit/env/fixtures/invalid-declaration.env | Fixture for invalid declaration (missing =) validation. |
| tests/unit/env/fixtures/basic.env | Fixture covering whitespace, quotes, comments, escaping, and interpolation scenarios. |
| tests/unit/env/DotenvLoaderTest.php | Unit tests validating loader behavior and expected exceptions/messages. |
| src/mako/env/exceptions/EnvException.php | New exception type for dotenv/env parsing/loading errors. |
| src/mako/env/DotenvLoader.php | New dotenv loader implementation (parsing, interpolation, override/putenv options). |
| CHANGELOG.md | Notes the new dotenv loader feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
freost
marked this pull request as ready for review
July 25, 2026 20:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type
Additional information
Description
Add a simple and fast dotenv loader. The loader can interpolate variables but does not do so by default. It will also not override existing values unless configured to do so.