corecave/laravel-zatca
A Laravel package for integrating ZATCA Saudi e-invoicing, with tools for compliant invoice generation, QR codes, XML/UBL output, and Phase 1/2 workflows to simplify VAT reporting and API connectivity.
Saudi market entry / expansion gating. ZATCA Phase 2 (Integration Phase) is a legal prerequisite to invoice Saudi customers at all. This package is a candidate to satisfy that gate for a Laravel backend, and its presence or absence directly affects whether a KSA launch date is credible. v1.2.0 does not change this gate — it remains the same legal dependency — but it does confirm the package is still moving.
Build vs. buy vs. borrow for the compliance layer. The realistic options are: (a) build UBL 2.1 XML generation, canonicalization, secp256k1 signing, TLV QR encoding, and the Fatoora clearance/reporting APIs in-house; (b) license a ZATCA-accredited vendor with a support contract; (c) adopt an OSS package like this and own the residual risk. This package is the cheapest path (MIT, no per-invoice fees), so the decision becomes "is the savings worth the maintenance and audit burden?" v1.2.0 adds a presentation-layer capability (PNG/SVG QR rendering) on top of the compliance core — convenient, but it does not shift the build-vs-buy economics, which are driven by signing, clearance/reporting, and certificate lifecycle.
Scope decisions on invoice flows. Force the team to specify which flows ship in v1: standard tax invoices (B2B, clearance API, requires buyer VAT and acceptance/rejection handling) vs. simplified tax invoices (B2C, reporting API, QR mandatory at issuance), plus credit/debit notes. Whether the package cleanly abstracts both flows determines whether B2B is a v1 or v2 item. New in v1.2.0: the package now emits QR as PNG/SVG, which directly reduces scope on the B2C side — simplified-invoice QR must be visible on the issued receipt/PDF/email, and that rendering work no longer has to be built. Treat this as a small scope credit for B2C v1, not as evidence the QR TLV encoding itself is correct (those are separate concerns; the TLV payload still needs sandbox validation).
Roadmap sequencing around Phase 2 waves. ZATCA onboarding is wave-based by revenue threshold; if we onboard mid-wave, we inherit an integration deadline, not a self-chosen one. That makes this a fixed-date dependency to slot ahead of feature work, and it justifies carving out a dedicated "compliance" epic rather than folding it into billing. The v1.1.0 → v1.2.0 cadence is a positive signal that the dependency is being actively worked, which slightly de-risks the fixed-date bet — but it does not change the deadline's immovability.
Multi-tenant / marketplace product design. If we sell to Saudi merchants (SaaS invoicing, marketplace seller tools), per-tenant CSID management, certificate rotation, and environment separation (sandbox / simulation / production) become product requirements — not implementation details. The package's support for per-tenant credentials is a feature-level input here. Nothing in v1.2.0 addresses this; it stays an open diligence item.
Customer-facing document design. Because the package now returns QR images directly, the question of where the QR appears (invoice PDF, email body, POS receipt, customer portal) becomes a product/design decision we can make without an engineering dependency. Prior releases forced that work into the build; now it's a template choice. Worth noting for any B2C receipt redesign already on the roadmap.
Procurement and lock-in posture. MIT + self-hosted means no vendor dependency for the core, but it also means no vendor accountability to ZATCA. This informs whether we budget an internal owner (a named engineer accountable for ZATCA spec changes) as part of the resourcing ask. v1.2.0 introduces a new transitive dependency (simplesoftwareio/simple-qrcode) — trivial in risk, but it must enter our dependency-review and license-scan process, and it means the QR-image feature is optional rather than core.
Diligence checklist this assessment should trigger before commit:
Adopt (with caveats) if:
Look elsewhere if:
Middle path worth recommending: use it in the sandbox to build institutional knowledge of the ZATCA spec quickly, then decide between forking it as the production path and using that knowledge to negotiate/scope a vendor. The faster release cadence and corrected documentation make this path marginally more attractive than at v1.1.0.
To executives: ZATCA Phase 2 is a hard legal requirement for invoicing in Saudi Arabia — no workaround, no postponement by us. This package is an MIT-licensed Laravel component that implements most of the technical integration, which lets us reach compliance in weeks rather than a quarter, at zero license cost and no per-invoice fees. The tradeoff is maturity: it's a small, single-maintainer project with essentially no adoption, so we would be taking ownership of its correctness. The latest release (v1.2.0) is a good sign — the maintainer is active, shipped customer-facing QR rendering for invoices and receipts, and rewrote documentation that was previously inaccurate — but it doesn't change the underlying risk profile: no second maintainer, no security review, no vendor to hold accountable. I'm recommending we use it as the starting point, fund a short hardening and sandbox-validation phase, and hold a supported vendor as the fallback if validation fails. Either way, we need a named internal owner for this — the ZATCA spec changes and certificates expire, and compliance is ongoing, not a one-time ship. Net: low cash cost, real engineering ownership, a slightly smaller B2C build than last month, and the fastest credible path to a defensible KSA launch date.
To engineering: Treat the package as a spec-accurate starting point, not a drop-in. It should absorb the low-value, high-friction work — UBL 2.1 XML, canonicalization, secp256k1 signing, TLV QR, hash chaining, and the Fatoora API calls — but we must validate every one of those against the ZATCA sandbox before production, and we must own CSID onboarding, renewal, and environment switching regardless of what the package gives us. Plan for: a fork under our org, a conformance test suite against sandbox fixtures, structured logging of every submission with the ZATCA response retained for audit, and idempotent retry around the clearance endpoint. Flag any gap in B2B clearance vs. B2C reporting early — that's the most likely scope surprise and it changes the v1 surface.
v1.2.0 specifics for the build plan: the new qr_code_image / qr_code_svg accessors require simplesoftwareio/simple-qrcode — add it to the dependency review and licence scan, and pin it. Verify the accessors derive from the package's own TLV payload rather than re-encoding from raw fields (a second encoding path is a correctness risk, not a convenience). Expose or preserve the raw TLV base64 string for mobile/POS consumers instead of routing them through image generation. And treat the README corrections (VAT number format, production CSID requiring no OTP) as a prompt to diff docs against code — documentation that was wrong at v1.1.0 may still be wrong somewhere the rewrite didn't touch.
How can I help you explore Laravel packages today?