- How do I install ibericode/vat in a Laravel application?
- Run composer require ibericode/vat. The core library is framework-agnostic, so there are no migrations, published config files, or facades. In Laravel, wrap the validator, rates, and calculator classes behind your own service provider and interfaces. Optional Laravel integration exists, but caching, retries, and configuration remain yours to build.
- Which Laravel and PHP versions does ibericode/vat support?
- The core package is framework-agnostic and its PHP version constraints are defined in Composer; it does not require Laravel. Optional Laravel integration is available, but verify exact supported Laravel versions in the package metadata before adoption. Check PHP constraints and ext-soap availability early.
- How do I validate an EU VAT number against VIES with ibericode/vat?
- Instantiate the validator class and call it with the VAT number; it queries the European Commission VIES service to confirm registration and validity. Treat a format-valid but unregistered VAT number differently from VIES being unreachable. The library exposes the VIES call but not a full resilience policy, so map outcomes explicitly in your adapter.
- What should happen when VIES is unavailable or times out?
- VIES has no meaningful SLA and member-state backends can fail independently, so a synchronous checkout call is an availability risk. The library does not give you retry, backoff, circuit breaker, or reliable timeout defaults; implement those in your wrapper. Decide whether to block, allow with a flag, or defer revalidation, and never silently treat an unreachable VIES as invalid.
- How do I get the current VAT rate for an EU country?
- Use the rates class to fetch the current VAT percentage for an EU country from the EU's official rates database. This is a default-rate source, not a full tax engine. Store the returned rate with the transaction and define your own rounding policy.
- Does ibericode/vat handle reduced, zero, parking rates, and territory exceptions?
- A single rate-for-country lookup does not model reduced, zero, parking rates, mid-year changes, or territory exceptions such as the Canary Islands, Åland, Heligoland, and Monaco. The package rates ship as data updated on a release cadence. Treat ibericode/vat as a default rate source and handle exceptions in your tax logic.
- Can I cache VAT validation results and rate lookups?
- The library does not provide caching; you add it in your Laravel wrapper. Cache VIES results and rate lookups with sensible TTLs, and make cache keys include the VAT number and country. Because VIES is rate-limited and slow, caching plus a documented fallback policy is strongly recommended.
- What PHP extensions or runtime requirements does ibericode/vat need?
- The core is dependency-light PHP and framework-agnostic. VIES validation relies on SOAP, so confirm ext-soap is installed in your runtime images. Also verify the package's PHP version constraints against your Laravel and CI environments early.
- Is ibericode/vat actively maintained, and what are the alternatives?
- The project has a modest footprint and a small maintainer base, so single-maintainer abandonment is a plausible risk. Its MIT license and tiny API mean forking or vendoring is feasible, but make that a conscious decision. For alternatives, compare direct VIES SOAP clients and dedicated tax engines if you need audit evidence, resilience, or complex rate modeling.
- How do I test VAT validation without calling VIES in CI?
- Wrap VIES validation behind your own VatValidator interface and fake it in unit tests, so CI does not depend on the external service. Keep a small number of opt-in integration tests for real VIES behavior. Test format-valid, unregistered, and VIES-unreachable paths separately.