File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ // SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
4+ // SPDX-License-Identifier: AGPL-3.0-or-later
5+
6+ declare (strict_types=1 );
7+
8+ namespace LibreCodeCoop \NfsePHP \Config ;
9+
10+ /**
11+ * Immutable configuration for the NFS-e environment (sandbox vs. production).
12+ *
13+ * When no custom base URL is supplied the appropriate official endpoint is
14+ * selected automatically from the sandboxMode flag:
15+ *
16+ * - Production: https://nfse.fazenda.gov.br/NFS-e/api/v1
17+ * - Sandbox: https://hml.nfse.fazenda.gov.br/NFS-e/api/v1
18+ */
19+ final readonly class EnvironmentConfig
20+ {
21+ private const BASE_URL_PROD = 'https://nfse.fazenda.gov.br/NFS-e/api/v1 ' ;
22+ private const BASE_URL_SANDBOX = 'https://hml.nfse.fazenda.gov.br/NFS-e/api/v1 ' ;
23+
24+ public string $ baseUrl ;
25+
26+ public function __construct (
27+ public bool $ sandboxMode = false ,
28+ ?string $ baseUrl = null ,
29+ ) {
30+ $ this ->baseUrl = $ baseUrl ?? ($ sandboxMode
31+ ? self ::BASE_URL_SANDBOX
32+ : self ::BASE_URL_PROD );
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments