-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnvironmentConfig.php
More file actions
34 lines (28 loc) · 1018 Bytes
/
EnvironmentConfig.php
File metadata and controls
34 lines (28 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
// SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
// SPDX-License-Identifier: AGPL-3.0-or-later
declare(strict_types=1);
namespace LibreCodeCoop\NfsePHP\Config;
/**
* Immutable configuration for the NFS-e environment (sandbox vs. production).
*
* When no custom base URL is supplied the appropriate official endpoint is
* selected automatically from the sandboxMode flag:
*
* - Production: https://nfse.fazenda.gov.br/NFS-e/api/v1
* - Sandbox: https://hml.nfse.fazenda.gov.br/NFS-e/api/v1
*/
final readonly class EnvironmentConfig
{
private const BASE_URL_PROD = 'https://nfse.fazenda.gov.br/NFS-e/api/v1';
private const BASE_URL_SANDBOX = 'https://hml.nfse.fazenda.gov.br/NFS-e/api/v1';
public string $baseUrl;
public function __construct(
public bool $sandboxMode = false,
?string $baseUrl = null,
) {
$this->baseUrl = $baseUrl ?? ($sandboxMode
? self::BASE_URL_SANDBOX
: self::BASE_URL_PROD);
}
}