PHPackages                             rafahernandez/rfc-validator - 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. rafahernandez/rfc-validator

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

rafahernandez/rfc-validator
===========================

Utility to validate string for Mexican RFC

v1.0(4y ago)032MITPHPPHP ^7.4|^8.0

Since Sep 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/rafahernandez/rfc-validator)[ Packagist](https://packagist.org/packages/rafahernandez/rfc-validator)[ Docs](https://github.com/rafahernandez/rfc-validator)[ GitHub Sponsors](https://github.com/:vendor_name)[ RSS](/packages/rafahernandez-rfc-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

Utility to validate string for Mexican RFC
==========================================

[](#utility-to-validate-string-for-mexican-rfc)

[![Latest Version on Packagist](https://camo.githubusercontent.com/aeb3072bb2a13121eae16bccde4366688a72ad016ad954c6866c0b12da2e6329/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726166616865726e616e64657a2f7266632d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rafahernandez/rfc-validator)[![GitHub Tests Action Status](https://camo.githubusercontent.com/9d0ca9a326a8cb2215738a55364e82a2a8da642f4db36b2d1a05ad5c77517248/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f726166616865726e616e64657a2f7266632d76616c696461746f722f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/rafahernandez/rfc-validator/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/9779110d3a22324dc62eca4ae96390f1ac4964361b18834554fc3263ef370c29/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f726166616865726e616e64657a2f7266632d76616c696461746f722f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/rafahernandez/rfc-validator/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/d9a174892e9349fd5077ce474bbae57dae0f2f72b8fdaa2754dcffd55ec8fad4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726166616865726e616e64657a2f7266632d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rafahernandez/rfc-validator)

---

Español
-------

[](#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
-------

[](#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
------------

[](#installation)

You can install the package via composer:

```
composer require rafahernandez/rfc-validator
```

Usage
-----

[](#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
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Rafael Hernandez](https://github.com/rafahernandez)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1689d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/75ebd6ba22e02c4f09f6865f5b7a018154ebf500e606289336f713c448d6524b?d=identicon)[Rafahernandez](/maintainers/Rafahernandez)

---

Top Contributors

[![rafahernandez](https://avatars.githubusercontent.com/u/8619998?v=4)](https://github.com/rafahernandez "rafahernandez (3 commits)")

---

Tags

laravelrafahernandezrfc-validator

###  Code Quality

TestsPest

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rafahernandez-rfc-validator/health.svg)

```
[![Health](https://phpackages.com/badges/rafahernandez-rfc-validator/health.svg)](https://phpackages.com/packages/rafahernandez-rfc-validator)
```

###  Alternatives

[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[ziming/laravel-zxcvbn

Zxcvbn Password validation rule for Laravel

3056.7k](/packages/ziming-laravel-zxcvbn)[laravel-validation-rules/phone

Validate that a phone number is in the correct format

69355.5k](/packages/laravel-validation-rules-phone)

PHPackages © 2026

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