billing.identifier) manages CAF (Código de Autorización de Folios) files, which authorize the use of folio numbers for electronic tax documents.
Overview
This component handles loading, validating, providing, and generating CAF files. CAF files are required to assign valid folio numbers to tax documents before they can be sent to SII.Workers
The Identifier Component contains the following workers:CAF Loader
Loads CAF files from various sources (XML strings, files, providers)
CAF Validator
Validates CAF file integrity, signatures, and expiration
CAF Provider
Provides CAF files from configured sources or storage
CAF Faker
Generates fake CAF files for testing and development
Worker Access Methods
getCafLoaderWorker
Returns the CAF loader worker for loading CAF files.Returns the CAF loader worker instance
getCafValidatorWorker
Returns the CAF validator worker for validating CAF files.Returns the CAF validator worker instance
getCafProviderWorker
Returns the CAF provider worker for obtaining CAF files from configured sources.Returns the CAF provider worker instance
getCafFakerWorker
Returns the CAF faker worker for generating test CAF files.Returns the CAF faker worker instance
getWorkers
Returns all available workers.Returns an associative array with worker names as keys:
caf_loader: CafLoaderWorkerInterfacecaf_validator: CafValidatorWorkerInterfacecaf_provider: CafProviderWorkerInterfacecaf_faker: CafFakerWorkerInterface
CAF Entity
The component works with the CAF entity that represents a folio authorization file:Caf
Represents a CAF (Código de Autorización de Folios) with all its properties:- Document type (TipoDTE)
- Issuer RUT
- Folio range (from/to)
- Authorization date
- Private key for signing
- Digital signature
libredte\lib\Core\Package\Billing\Component\Identifier\Entity\Caf
CafBag
Container object that holds a CAF along with metadata and validation results. Support:libredte\lib\Core\Package\Billing\Component\Identifier\Support\CafBag
Usage Examples
Loading a CAF
Validating a CAF
Providing a CAF
Generating Fake CAFs for Testing
CAF Provider Interface
You can implement custom CAF providers by implementing theCafProviderInterface:
Fake Provider for Testing
The component includes a fake CAF provider for testing: Service:libredte\lib\Core\Package\Billing\Component\Identifier\Service\FakeCafProvider
Error Handling
The component throws specific exceptions:CafLoaderException: CAF loading errorsCafValidatorException: CAF validation errorsCafException: General CAF errorsIdentifierException: General identifier component errors
Source Reference
Namespace:libredte\lib\Core\Package\Billing\Component\Identifier\IdentifierComponent
Location: /workspace/source/src/Package/Billing/Component/Identifier/IdentifierComponent.php:41