greenter/ubl-validator
Validate UBL (OASIS Universal Business Language) XML documents against official XSD schemas. Automatically resolves the UBL version, locates the matching schema, and reports validation errors. Supports custom XSD directories for other UBL versions.
<cbc:UBLVersionID>, and wiring libxml error handling. That engineering capacity is better spent on the ingestion workflow, reconciliation, and UX around failures.ExceptionalIndicator release). Adopting this package is a cheap way to prove out a new market's document flow before committing to a full integration, because you can point it at a custom XSD directory for a new country/version without a code change.getError(), the PM decision is how much error fidelity to surface. A thin wrapper that maps XSD failures into human-readable remediation guidance ("missing supplier tax ID", "wrong UBL version") directly reduces onboarding support tickets and time-to-first-valid-invoice — a metric worth tracking.Consider it when:
UblPathResolver::baseDirectory lets you swap in a customer-specific or newer XSD set without forking.Look elsewhere (or supplement) when:
storage/.Adoption checklist before committing (1 day of spikes):
baseDirectory path structure (2.1/common, 2.1/maindoc).composer.json and add fixtures to your test suite so an upgrade can't silently change acceptance behavior.For executives (30 seconds):
"We need to accept and check electronic invoices in UBL format from partners and for tax/Peppol submissions. Rather than build and maintain schema validation ourselves, we adopt a free, MIT-licensed, dependency-free PHP library that does exactly that in a single call. It removes 1–2 sprints of undifferentiated work, carries no licensing cost, and because it's a small library behind our own wrapper, it's easy to replace if it stops being maintained. It is not a compliance silver bullet — it checks document structure, and we still need a business-rules check plus the submission integration. This is the cheapest way to de-risk the first part and prove out a new e-invoicing market before we invest in the rest."
For engineering:
composer require greenter/ubl-validator.new UblValidator(); $v->isValid($xml) ?: $v->getError(); — trivially bindable in a service provider, callable from a queued job, middleware, or artisan command.UblPathResolver::baseDirectory to control XSD versions; subclass UblValidator to normalize errors before they hit the API or logs.isValid() in try/catch (malformed XML surfaces as libxml errors, not graceful failures), pin the package version, vendor or reference custom XSD sets deliberately, and add fixture-based regression tests so upgrades don't change what we accept.Honest risk framing to include in the decision record: low stars and a single maintainer mean we treat this as a replaceable utility, not a platform. The interface is one class and one method — the cost of switching later is small, which is precisely why adopting it now is a low-regret decision.
How can I help you explore Laravel packages today?