jamesforsyth/laravel-uk-kyb-edge
A Laravel package for UK KYB (Know Your Business) checks, offering a clean API for company verification and edge-case handling. Configure services, run checks, and integrate compliance workflows quickly.
Architecture fit: v1.1.0 materially expands the package from basic UK business registry access into document retrieval and document intelligence. The Laravel Facade plus UKBusinessClient Guzzle methods fit standard Laravel service-container patterns and are suitable for internal tools, admin dashboards, onboarding/ KYB workflows, and due-diligence prototypes. UKBusiness::financials($documentId) is the higher-value capability because it converts balance-sheet PDFs into structured JSON, but it also introduces an external vision/OCR dependency and a data-contract surface that the package must own. UKBusiness::document($documentId) is a simpler streaming proxy for official registry PDFs, useful for controlled document access and browser-based preview if CORS is intentional.
Integration feasibility: Initial integration appears feasible for a Laravel application already using Guzzle: install via Composer, configure credentials/base URL, register the Facade, and call the new methods. The main feasibility question is not Laravel wiring but upstream reliability and schema stability. financials() likely depends on document availability, PDF quality, and a vision extraction provider; the package must expose clear timeouts, retries, error types, and structured validation failures. document() streaming must avoid loading large PDFs into memory and must protect registry access with auth/rate limits rather than relying on CORS.
Technical risk: The largest risks are accuracy and compliance around financial data, undocumented JSON schema changes, upstream rate limits/costs, and PDF streaming behavior. “Full CORS headers enabled” is a red flag unless configurable and scoped: wildcard CORS on streamed official documents can expose documents to unintended browser origins. Vision extraction introduces model/prompt drift, malformed PDF handling, confidence/scoring gaps, and potential PII/financial data leakage to third-party services. Updating Facade and Guzzle methods in a minor release should be non-breaking under SemVer, but TPM should verify method signatures, default timeouts, and response shapes.
Key questions: Is the financials() JSON schema documented, versioned, and validated? Which vision/OCR provider is used, under what data-retention and residency terms? Does financials() return confidence/error details, or only success JSON? Are document IDs authorized per tenant/user? Are CORS headers configurable, and do they default to *? Are streamed PDFs cached, logged, or proxied through the app? What are upstream rate limits, licensing terms, and failure modes? Which Laravel/PHP/Guzzle versions are supported? Are there tests for malformed PDFs, timeouts, and schema drift?
Stack fit: Good fit for Laravel applications using Composer and Guzzle. The package can be consumed as a service-layer dependency behind an application-owned adapter, which is preferable to calling the Facade directly from controllers. TPM should position it as an accelerator for internal document workflows, not as an authoritative financial-data source until extraction accuracy and auditability are proven.
Migration path: No prior assessment exists, so v1.1.0 becomes the baseline. Start with a bounded proof of concept: configure credentials, call document() against known registry documents, then call financials() on a small, manually verified set of balance sheets. Compare extracted JSON to source PDFs and define an internal schema adapter before any UI or downstream workflow depends on package output.
Compatibility: Confirm Laravel and PHP support matrix, Guzzle version constraints, Facade alias registration, config publishing, and whether document() returns a streamed response or a PSR-7 response. Check CORS defaults and whether they can be disabled globally or per route. Because v1.1.0 updates Facade and Guzzle methods, run contract tests against pinned dependency versions and inspect method signatures before upgrading an existing app.
Sequencing: 1) dependency and config spike; 2) document() streaming behind authenticated internal route with rate limiting; 3) financials() extraction on a small verified corpus; 4) JSON schema validation and fallback handling; 5) queue/caching layer for extraction; 6) internal UI or API exposure; 7) only then consider customer-facing use. Keep the package behind an application-owned interface so upstream changes or replacement providers do not leak into product code.
Maintenance: Expect ongoing maintenance around upstream registry/API changes, vision-provider model changes, prompt/schema versioning, and PDF-format edge cases. The package should be pinned and upgraded deliberately; minor releases that update Guzzle methods still require regression tests. TPM should require a documented JSON contract and changelog discipline before relying on financials() in production.
Support: Support burden will center on failed document lookups, extraction inaccuracies, timeouts, rate limits, and CORS/security misconfigurations. Define ownership for validating extracted financials and for handling disputes. Internal support runbooks should cover “document not found,” “PDF unreadable,” “extraction schema mismatch,” and “upstream unavailable.”
Scaling: document() streaming should be lightweight if responses are streamed and not buffered. financials() is the scaling bottleneck: vision extraction is slower and costlier, so it should run asynchronously via queues, with caching by document ID and extracted-schema version. Add rate limiting, retries with backoff, and storage controls for any cached PDFs or JSON.
Failure modes: Upstream registry outages, expired credentials, rate limiting, malformed/scanned PDFs, extraction hallucinations or missing line items, schema drift, memory exhaustion from non-streamed PDFs, and permissive CORS exposing documents. financials() should fail closed with explicit errors and never silently return partial JSON as authoritative. document() should enforce authorization and avoid wildcard CORS by default.
Ramp-up: A Laravel developer can integrate the Facade and Guzzle client quickly. The real ramp-up is domain validation: finance/ops users must verify balance-sheet extraction against source documents, and security/legal must approve document streaming, CORS, data retention, and third-party vision processing. TPM should budget a short technical spike plus a validation phase before committing to production use.
How can I help you explore Laravel packages today?