rafahernandez/rfc-validator

Utility to validate string for Mexican RFC

v1.0 2021-09-24 21:22 UTC

This package is auto-updated.

Last update: 2024-10-29 06:12:56 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Español

Este paquete contiene una regla para validar RFC (Registro Federal de contribuyentes) mexicanos.

No valida las fechas, ni hace llamadas externas para comprobar si existen.

English

This package contains a rule to validate Mexican RFCs (Equivalent to other countries Tax ID).

It does not validate the dates, nor does it make external calls to check if they exist.

Installation

You can install the package via composer:

composer require rafahernandez/rfc-validator

Usage

use RafaHernandez\RfcValidator\RFC;

$request->validate([
    'rfc' => ['required', new RFC()],
]);

Optional, define the type of fiscal person

use RafaHernandez\RfcValidator\RFC;

// XAXX010101000 will fail
// XAX010101000 will pass

$request->validate([
    'rfc' => ['required', new RFC(RFC::PERSONA_MORAL)], //also available PERSONA_FISICA
]);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.