feat(config): add EnvironmentConfig and CertConfig DTOs; refactor NfseClient constructor#6
Merged
vitormattos merged 6 commits intomainfrom Mar 22, 2026
Merged
Conversation
Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: Vitor Mattos <vitor@php.rio>
…rtConfig Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: Vitor Mattos <vitor@php.rio>
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.
Summary
Completes Phase 1 of the nfse-php package-core plan by adding the missing config contracts: environment and certificate DTOs.
Changes
New:
src/Config/EnvironmentConfig.phpImmutable DTO encapsulating sandbox/production mode and the derived base URL.
sandboxMode=falsesandboxMode=truebaseUrloverride (for tests and custom deployments)New:
src/Config/CertConfig.phpImmutable DTO for mTLS certificate configuration.
cnpj— 14-digit contributor CNPJ matching the ICP-Brasil certificate subjectpfxPath— absolute filesystem path to the PFX bundlevaultPath— OpenBao KV path for just-in-time password retrievalRefactored:
src/Http/NfseClient.phpConstructor now accepts
EnvironmentConfigandCertConfiginstead of raw primitives (sandboxMode: bool,baseUrlOverride: ?string).BASE_URL_PROD/BASE_URL_SANDBOXconstants (now inEnvironmentConfig)EnvironmentConfigTests
tests/Unit/Config/EnvironmentConfigTest.php— 4 new tests for URL resolution logictests/Unit/Config/CertConfigTest.php— 4 new tests for property storage and readonly enforcementtests/Unit/Http/NfseClientTest.php— updated to usemakeClient()helper with new DTOsTest count: 19 → 27 unit tests
Gates