Download the PHP package matiz-studio-creative/sri-toolkit without Composer
On this page you can find all versions of the php package matiz-studio-creative/sri-toolkit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download matiz-studio-creative/sri-toolkit
More information about matiz-studio-creative/sri-toolkit
Files in matiz-studio-creative/sri-toolkit
Package sri-toolkit
Short Description PHP toolkit for Ecuador SRI electronic documents: access keys, XML builders, XAdES-BES signing and SOAP delivery.
License MIT
Homepage https://sri-toolkit.matizstudiocreative.com
Informations about the package sri-toolkit
SRI Toolkit
PHP toolkit for Ecuador SRI electronic documents. It helps generate access keys, build XML documents, sign them with XAdES-BES using PKCS#12 certificates, and send signed XML to the SRI reception and authorization web services.
Documentation
Full documentation is available at sri-toolkit.matizstudiocreative.com.
Features
- Electronic signing with PKCS#12 certificate files (
.p12/.pfx) using the SRI-compatible XAdES-BES flow. - Certificate metadata extraction for issuer, serial number and RSA public key material required by the XML signature.
- XML generation for the main SRI electronic documents: invoices, purchase settlements, credit notes, debit notes, delivery guides and withholding receipts.
- XML structures aligned with the official SRI document formats and ready for signing.
- SOAP client for SRI reception and authorization web services.
- Automatic 49-digit SRI access key generation with the modulo 11 verification digit.
- Typed reception and authorization response parsing.
- Support for SRI testing and production environments.
- Testable internals through injectable SOAP, clock, signer and sleeper dependencies.
Requirements
- PHP >= 8.2
- PHP extensions:
ext-soapext-opensslext-domext-libxml
- Composer
The CI suite currently runs against PHP 8.2, 8.3, 8.4 and 8.5.
Installation
Supported Documents
Access key generation exposes the six SRI electronic document codes from the official offline technical sheet:
| Code | Document | Access key |
|---|---|---|
01 |
Invoice | DocumentType::Invoice |
03 |
Purchase settlement | DocumentType::PurchaseSettlement |
04 |
Credit note | DocumentType::CreditNote |
05 |
Debit note | DocumentType::DebitNote |
06 |
Remission guide | DocumentType::RemissionGuide |
07 |
Withholding receipt | DocumentType::RetentionVoucher |
XML generation currently supports:
| Code | Document | Enum | XML version |
|---|---|---|---|
01 |
Invoice | XmlDocumentType::Invoice |
2.1.0 |
03 |
Purchase settlement | XmlDocumentType::PurchaseSettlement |
1.1.0 |
04 |
Credit note | XmlDocumentType::CreditNote |
1.1.0 |
05 |
Debit note | XmlDocumentType::DebitNote |
1.0.0 |
06 |
Delivery guide | XmlDocumentType::DeliveryGuide |
1.1.0 |
07 |
Withholding receipt | XmlDocumentType::WithholdingReceipt |
2.0.0 |
Catalogs
Common document codes are available through a runtime-overridable catalog registry based on the official offline technical sheet v2.26 and the ICE annex.
PHP reserves list as a declared method name, so CatalogRegistry also exposes entries('payment-methods') for static-analysis-friendly code. The magic $catalogRegistry->list(...) call is supported for compatibility with the TypeScript API shape.
Common Document Codes
Identification types (customer.identification_type, subject.identification_type, carriers):
| Code | Type |
|---|---|
04 |
Taxpayer ID |
05 |
National ID |
06 |
Passport |
07 |
Final consumer |
08 |
Foreign ID |
VAT (percentage_code when tax code is 2):
| Code | Rate | Notes |
|---|---|---|
0 |
0% | VAT 0% |
2 |
12% | Historical |
3 |
14% | Historical |
4 |
15% | Common current rate |
5 |
5% | Added by official sheet v2.26 |
6 |
0% | Not subject to tax |
7 |
0% | VAT exempt |
8 |
variable | Differentiated VAT |
10 |
13% | Added by official sheet v2.26 |
Payment methods:
| Code | Description |
|---|---|
01 |
No financial system used |
15 |
Debt compensation |
16 |
Debit card |
17 |
Electronic money |
18 |
Prepaid card |
19 |
Credit card |
20 |
Other financial system method |
21 |
Title endorsement |
VAT withholding (code: '2', withholding_code):
| Code | Rate |
|---|---|
9 |
10% |
10 |
20% |
1 |
30% |
11 |
50% |
2 |
70% |
3 |
100% |
7 |
0%, zero withholding |
8 |
0%, withholding does not apply |
Full catalog: use $catalogRegistry->list('vat-withholding').
Quick Start
Generate an Access Key
If numericCode is omitted, the package generates a random 8-digit numeric code.
Generate XML
The payload shape depends on the selected document type. Invalid or incomplete payloads throw XML generation exceptions.
Sign XML
The XML root must contain the expected SRI document id:
The signer uses the SRI-compatible XMLDSig/XAdES-BES structure implemented by this package.
Send to SRI
The sender uses the official SRI WSDL URLs for testing and production based on SenderConfig.
Development
Install dependencies:
Run tests:
Run the full quality suite:
Useful commands:
The documentation site is built with VitePress:
Security
This package handles private keys, certificate passwords, signed XML and taxpayer data. Store certificates outside the repository and web root, keep passwords in a secret manager or protected environment variable, and avoid logging signed XML or SOAP traces in production.
See security guidance in the documentation.
License
This package is open-sourced software licensed under the MIT license.
All versions of sri-toolkit with dependencies
ext-dom Version *
ext-libxml Version *
ext-openssl Version *
ext-soap Version *
aws/aws-sdk-php Version ^3.381
ramsey/uuid Version ^4.9