Verifactu-PHP provides two identifier classes for invoice parties.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/josemmo/Verifactu-PHP/llms.txt
Use this file to discover all available pages before exploring further.
FiscalIdentifier represents Spanish entities identified by a domestic NIF, and is used wherever a Spanish fiscal identity is required — the taxpayer, a representative, or a domestic invoice recipient. ForeignFiscalIdentifier handles entities outside Spain and carries the additional country code and identification type required by the AEAT schema for foreign parties.
FiscalIdentifier
Namespace:josemmo\Verifactu\Models\Records\FiscalIdentifier
Represents a Spanish fiscal entity by legal name and NIF. Used as the $taxpayer and $representative arguments of AeatClient, and as the domestic recipient in RegistrationRecord.
Constructor
Legal name or trade name of the entity. Sets
$this->name when provided.Spanish tax identification number. Sets
$this->nif when provided.Properties
Legal name or trade name (nombre-razón social).
- Must not be blank
- Maximum 120 characters
- Corresponds to XML field
NombreRazon
Spanish NIF of the entity.
- Must not be blank
- Exactly 9 characters
- Corresponds to XML field
NIF
Typical uses
| Context | Argument name |
|---|---|
AeatClient constructor | $taxpayer |
AeatClient::setRepresentative() | $representative |
RegistrationRecord domestic recipient | depends on record type |
ForeignFiscalIdentifier
Namespace:josemmo\Verifactu\Models\Records\ForeignFiscalIdentifier
Represents a non-Spanish entity identified by a country code, an ID type, and the ID value itself. Used in RegistrationRecord when the invoice recipient is a foreign party.
Constructor
Legal name of the entity. Sets
$this->name when provided.ISO 3166-1 alpha-2 country code (e.g.
"FR", "DE"). Sets $this->country when provided.Identification type enum case. Sets
$this->type when provided.The actual identification number or document value. Sets
$this->value when provided.Properties
Legal name or trade name of the foreign entity.
- Must not be blank
- Maximum 120 characters
- Corresponds to XML field
NombreRazon
ISO 3166-1 alpha-2 country code in uppercase.
- Must not be blank
- Matches regex
/^[A-Z]{2}$/ - Corresponds to XML field
IDOtro/CodigoPais
The type of identification document or number.
- Must not be blank
- Corresponds to XML field
IDOtro/IDType
The identification number or document reference.
- Must not be blank
- Maximum 20 characters
- Corresponds to XML field
IDOtro/ID
ForeignIdType enum
josemmo\Verifactu\Models\Records\ForeignIdType is a backed string enum:
| Case | Raw value | Description |
|---|---|---|
VAT | 02 | NIF-IVA (VAT number) |
Passport | 03 | Pasaporte |
NationalId | 04 | Official national ID issued by the country of residence |
Residence | 05 | Certificado de residencia |
Other | 06 | Other proof document |
Unregistered | 07 | Not yet registered with AEAT — must be corrected later |
Validation rules
The following cross-field rules are enforced byvalidate() in addition to per-property constraints: