Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Facturax Contracts

Facturax Contracts Laravel Package

carloschininin/facturax-contracts

DTOs versionados (Api\V1\Dto) para contratos de la API Facturax. Permite construir y validar localmente payloads JSON antes de enviarlos o persistirlos. Incluye bundle Symfony opcional con servicios de validación y normalización.

View on GitHub
Deep Wiki
Context7

Contratos DTO versionados y bundle Symfony opcional para la API de Facturax.

Frequently asked questions about Facturax Contracts
Can I use this package in Laravel without Symfony dependencies?
Yes, the core DTOs (e.g., `ComprobanteRequestDto`) are decoupled from Symfony and work standalone. Only the optional `ContractValidator`/`ContractNormalizer` services require Symfony components like `symfony/options-resolver`. You can skip the bundle if avoiding Symfony.
What Laravel versions support this package?
The package requires PHP 8.5+ and Symfony 8.x, which aligns with Laravel 10+. For Laravel 9.x, you’d need to manually resolve Symfony version conflicts or upgrade. Test compatibility with `platform-check` before full adoption.
Does this cover all Factura-X profiles (e.g., BASIC, COMMUNICATION) for Mexico’s CFDI?
The package includes DTOs for core schemas (e.g., `ComprobanteRequestDto`) but lacks profile-specific validators (e.g., mandatory fields for `PERSONA_MORAL`). You’ll need custom logic or extensions like `heynemann/laravel-facturae` for full compliance.
How do I validate a Factura-X payload before sending to the API?
Use the DTOs to construct JSON payloads, then validate locally with `ContractValidator` (if using Symfony) or manually with Laravel’s `Validator`. Example: `$dto = new ComprobanteRequestDto($data); $validator->validate($dto)`. See `docs/examples/v1/` for JSON schemas.
Will this package work with Laravel Queues for async invoice processing?
The DTOs are queue-friendly, but the Symfony bundle’s services (e.g., `ContractNormalizer`) may not serialize well. For async workflows, use the DTOs directly in jobs and avoid bundle services, or mock Symfony dependencies with `illuminate/support`.
Are there alternatives for Factura-X validation in Laravel without Symfony?
Yes, consider `spatie/laravel-data` for structured DTOs or `heynemann/laravel-facturae` for CFDI-specific XML generation. For pure validation, Laravel’s built-in `Validator` or `laravel-validator` can handle JSON schemas manually.
How do I handle Symfony dependency conflicts in my Laravel project?
Run `composer why symfony/*` to audit conflicts. Resolve with explicit versions: `composer require symfony/options-resolver:^7.1 symfony/http-foundation:^7.1`. Avoid pulling in `symfony/console` or other heavy components unless needed.
Can I generate PDFs/XML from these DTOs for invoice rendering?
The package focuses on JSON payload validation, not rendering. For PDFs, integrate with `dompdf` or `spatie/pdf-to-html`. For XML (e.g., CFDI), use `heynemann/laravel-facturae` or manually transform DTOs to XML with `SimpleXMLElement`.
What’s the maintenance roadmap for PHP 8.3/8.4 support?
The package targets PHP 8.5+, so older versions (8.3/8.4) may not be supported. Check the GitHub repo for updates. If you need backward compatibility, fork the package or use a wrapper to abstract Symfony dependencies.
How do I test this package in a Laravel project?
Install via `composer require carloschininin/facturax-contracts`, then test DTOs with PHPUnit. For Symfony services, mock dependencies or use Laravel’s `MockApplication` to avoid container conflicts. Example: `php artisan test --filter TestFacturaxContracts`.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky