PHPackages                             aichadigital/lararoi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. aichadigital/lararoi

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

aichadigital/lararoi
====================

Agnostic package for intra-community NIF-VAT/VAT verification. Designed primarily for use with Larabill.

v1.0.4(yesterday)0636[1 issues](https://github.com/AichaDigital/lararoi/issues)1MITPHPPHP ^8.3CI passing

Since Nov 15Pushed yesterdayCompare

[ Source](https://github.com/AichaDigital/lararoi)[ Packagist](https://packagist.org/packages/aichadigital/lararoi)[ Docs](https://github.com/aichadigital/lararoi)[ GitHub Sponsors](https://github.com/:vendor_name)[ RSS](/packages/aichadigital-lararoi/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (72)Versions (26)Used By (1)

Lararoi
=======

[](#lararoi)

[![Latest Version on Packagist](https://camo.githubusercontent.com/dfffc2823f508fe496059850334d0bd7cbc817fd0655231da5ae3229d50f19c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61696368616469676974616c2f6c617261726f692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aichadigital/lararoi)[![GitHub Tests Action Status](https://camo.githubusercontent.com/4a7dd76100f27300d420213152c450d8b361b85c3ba22cea370a76538229fe92/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61696368616469676974616c2f6c617261726f692f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/aichadigital/lararoi/actions/workflows/run-tests.yml)[![PHPStan](https://camo.githubusercontent.com/76901e3eac634d06968746091d697e8ea67fd60fbc583420edd0cea7a6185e39/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61696368616469676974616c2f6c617261726f692f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d7068707374616e267374796c653d666c61742d737175617265)](https://github.com/aichadigital/lararoi/actions/workflows/phpstan.yml)[![Code Style](https://camo.githubusercontent.com/d90890ad58366f70fd74d76c145d4a872260cc88223e9e11b70221b9d1dc22fa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61696368616469676974616c2f6c617261726f692f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/aichadigital/lararoi/actions/workflows/fix-php-code-style-issues.yml)[![Total Downloads](https://camo.githubusercontent.com/8698b0580a46cb209a4510ec51bb4c39128d85be765fa78b76b07dd83f06bc43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61696368616469676974616c2f6c617261726f692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aichadigital/lararoi)

Lararoi is the Laravel package that **owns the intra-community VAT/NIF verification domain**: the verification itself, its cache, and a multi-consumer tracking/audit log — served to consuming apps through explicit, stable contracts and agnostic configuration. Consumers (billing, accounting, …) consume it; they never reimplement the domain.

The verification model is provider-agnostic (VIES SOAP/REST, isvat, viesapi, vatlayer) with automatic fallback and per-country syntax validation. See the [architecture decisions](docs/adr/) (ADR-001, ADR-002) for the domain-ownership rationale.

Features
--------

[](#features)

- ✅ VAT/NIF verification via VIES (European Commission) + multiple free/paid providers, with automatic fallback
- ✅ Per-country syntax validation (short-circuits obviously invalid numbers without hitting a provider)
- ✅ TTL cache (memory + database), one current row per NIF, enforced by a UNIQUE key
- ✅ **Multi-consumer tracking / audit log** — append-only, consumer-attributed, inert by default
- ✅ **Per-consumer retention** (declared in config, UTC) with a prune command
- ✅ **Per-consumer output mapping** — adapt the canonical result to your own shape without forking code
- ✅ **Formal, documented contract set** — swap the model, the tracking model, or the mapper via config/contracts
- ✅ Robust, typed error handling; development commands for testing against real APIs

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 12+

Installation
------------

[](#installation)

```
composer require aichadigital/lararoi
```

The database schema is **package-managed** — just run migrations, no stub to publish:

```
php artisan migrate
```

This creates the cache table `roi_vat_verifications` and the tracking table `roi_verification_queries`. Optionally publish the config to tune providers, cache, tracking and retention:

```
php artisan vendor:publish --tag="lararoi-config"
```

Basic Usage
-----------

[](#basic-usage)

```
use Aichadigital\Lararoi\Contracts\VatVerificationServiceInterface;

$result = app(VatVerificationServiceInterface::class)
    ->verifyVatNumber('B12345678', 'ES');

if ($result['is_valid']) {
    echo "Valid VAT: {$result['company_name']}";
}
```

Tracking is **off by default**. A consumer that wants an audit trail enables `lararoi.tracking.enabled`, registers itself in the `lararoi.consumers` allow-list (with a retention policy), and passes a `VerificationContext` — see the [Integration Guide](docs/integration.md).

Documentation
-------------

[](#documentation)

- **[Integration Guide](docs/integration.md)** — install → verify → track → retain → map (the full consumer flow)
- **[Contracts](docs/contracts.md)** — the public contract set (interfaces, value object, exceptions)
- **[Configuration](docs/configuration.md)** — config keys and environment variables
- **[Usage Guide](docs/usage.md)** — usage patterns and examples
- **[Architecture Decisions](docs/adr/)** — ADR-001 (domain ownership), ADR-002 (v1.0 design)
- **[Development Guide](docs/development.md)** — development commands and testing with real APIs
- **[Contributing](docs/contributing.md)** — guidelines for contributors

Testing &amp; Quality
---------------------

[](#testing--quality)

- Pest PHP test suite, PHPStan level 5, Laravel Pint, GitHub Actions CI.

```
composer test        # run the suite
composer quality     # pint + phpstan + tests
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Credits
-------

[](#credits)

- [Abdelkarim Mateos](https://github.com/abkrim)
- [Aicha Digital](https://github.com/aichadigital)
- [All Contributors](../../contributors)

###  Health Score

51

↑

FairBetter than 95% of packages

Maintenance100

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 93% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~25 days

Recently: every ~0 days

Total

10

Last Release

1d ago

Major Versions

v0.5.0 → v1.0.02026-07-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a4694c48c325d3dfbc4c43d97c2617f9317d7a447971750c338f943a88bd164?d=identicon)[abkrim](/maintainers/abkrim)

---

Top Contributors

[![abkrim](https://avatars.githubusercontent.com/u/1238625?v=4)](https://github.com/abkrim "abkrim (40 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

laravelvatverificationviesNIFivaroi

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/aichadigital-lararoi/health.svg)

```
[![Health](https://phpackages.com/badges/aichadigital-lararoi/health.svg)](https://phpackages.com/packages/aichadigital-lararoi)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.8k14](/packages/api-platform-laravel)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816334.1k3](/packages/defstudio-telegraph)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M167](/packages/spatie-laravel-health)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
