cosmin-ciolacu/eu-vat-number-validator

An simple validator for EU vat numbers with validation rule for requests

1.0.4 2024-08-02 09:20 UTC

This package is auto-updated.

Last update: 2025-03-30 11:00:08 UTC


README

A simple EU VAT number validator and validation rule for Laravel.

Installation

Via Composer

composer require cosmin-ciolacu/eu-vat-number-validator

Usage

use CosminCiolacu\EuVatNumberValidator\EuVatNumberValidator;

$vatNumber = 'RO123456789';
$isValid = EuVatNumberValidator::validate($vatNumber);

if ($isValid) {
    echo 'VAT number is valid';
} else {
    echo 'VAT number is not valid';
}

You can use in laravel validation rules like this:

use CosminCiolacu\EuVatNumberValidator\Rules\EUVatNumberValidationRule;

$rules = [
    'vat_number' => ['required', new EUVatNumberValidationRule]
];

$validator = Validator::make($request->all(), $rules);

Change log

Please see the changelog for more information on what has changed recently.

Testing

composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email cosminnciolacu99@gmail.com instead of using the issue tracker.

Credits

  • [Cosmnin Ciolacu][link-author]
  • [All Contributors][link-contributors]

License

MIT. Please see the license file for more information.