PHPackages                             anglemx/mexico-rfc - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. anglemx/mexico-rfc

ActiveGit[Utility &amp; Helpers](/categories/utility)

anglemx/mexico-rfc
==================

PHP utility to handle Mexico SAT's (Tax Authority) RFC (Tax ID)

v1.1.1(4y ago)012.4k—3.1%1MITPHPPHP &gt;=7.2

Since Jan 8Pushed 4y ago2 watchersCompare

[ Source](https://github.com/Angle/mexico-rfc)[ Packagist](https://packagist.org/packages/anglemx/mexico-rfc)[ Docs](https://github.com/Angle/mexico-rfc)[ RSS](/packages/anglemx-mexico-rfc/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (1)

Angle Mexico RFC
================

[](#angle-mexico-rfc)

PHP utility to handle Mexico SAT's (Tax Authority) RFC (Tax ID)

RFC
---

[](#rfc)

What is RFC? *Registro Federal de Contribuyentes* for the Mexican Tax Authority: SAT *Servicio de Administración Tributaria* and SHCP *Secretaría de Hacienda y Crédito Público*.

How to Use
----------

[](#how-to-use)

#### Calculate a Person's RFC from their Name and Date of Birth data

[](#calculate-a-persons-rfc-from-their-name-and-date-of-birth-data)

This calculates the *Homoclave* , which is a \_\_

However, *do note* this is only a baseline \_\_\_ and SAT can always change this \_\_ code

specially the last 3 digits called *homoclave*.

The whole purpose of this is to prevent \_\_

If two individuals were to have the exact same name born on the same date \_\_ then they would be homonyms \_\_ sharing the same base \_\_

SAT would then change the *homoclave* for one or both of them.

More testing and validation is still required, RFCs have a lot of exceptions and edge cases that must be considered.

```
$dob = \DateTime::createFromFormat('Y-m-d', '1989-07-15');
$rfc = RFC::createForNaturalPerson('Jose Ramiro', 'Gutierrez', 'Hernández', $dob);

echo $rfc->getRfc(); // GUHR890715
echo $rfc->getRfcComplete(); // GUHR890715G54
```

#### Validate existing RFC strings

[](#validate-existing-rfc-strings)

The utility can also be used to validate an existing RFC string and infer some metadata from it.

```
echo (RFC::isValid('INVALID_12313') ? 'Yes' : 'No'); // No
echo (RFC::isValid('GUHR890715G54') ? 'Yes' : 'No'); // Yes

echo (RFC::isValidWithoutHomoclave('GUHR890715') ? 'Yes' : 'No'); // Yes
```

#### Extract metadata from valid RFC strings

[](#extract-metadata-from-valid-rfc-strings)

Validate and infer some metadata from the RFC string, such as type of legal entity.

TODO: infer date of birth.

```
$rfc = RFC::createFromRfcString('GUHR890715G54');

if ($rfc === null) {
    die('Invalid RFC string');
}

echo ($rfc->isGeneric() ? 'Yes' : 'No'); // No
echo ($rfc->isNaturalPerson() ? 'Yes' : 'No'); // Yes
```

Tests
-----

[](#tests)

```
php vendor/bin/phpunit tests/BuildTest.php
php vendor/bin/phpunit tests/ValidationTest.php
```

TO-DO
-----

[](#to-do)

- Finish writing up this README
- Cleanup the RFC class, it's very messy right now. Also clean up the Tests for RFC verifications. Implement some way of testing private / protected methods ?
- Find a big list of Person Names, Date of Births and RFCs to test against.

References
----------

[](#references)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity46

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

Every ~0 days

Total

3

Last Release

1591d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/936483?v=4)[Edmundo Fuentes](/maintainers/edmundofuentes)[@edmundofuentes](https://github.com/edmundofuentes)

---

Top Contributors

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

---

Tags

satmexicorfcangle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anglemx-mexico-rfc/health.svg)

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

###  Alternatives

[phpcfdi/cfdi-sat-scraper

Web Scraping para extraer facturas electrónicas desde la página del SAT

9018.0k](/packages/phpcfdi-cfdi-sat-scraper)[eclipxe/cfdiutils

PHP Common utilities for Mexican CFDI 3.2, 3.3 &amp; 4.0

141129.9k6](/packages/eclipxe-cfdiutils)[phpcfdi/rfc

PHP library to deal with Mexican RFC

2562.4k3](/packages/phpcfdi-rfc)[phpcfdi/cfdi-cleaner

Clean up Mexican CFDI

1334.1k1](/packages/phpcfdi-cfdi-cleaner)[phpcfdi/xml-cancelacion

Genera documentos de cancelación de CFDI firmados (XMLSEC)

1149.5k4](/packages/phpcfdi-xml-cancelacion)[phpcfdi/sat-catalogos

Catálogos de SAT para CFDI 3.3, CFDI 4.0 y Nómina 1.2

304.6k24](/packages/phpcfdi-sat-catalogos)

PHPackages © 2026

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