承接 anglemx/mexico-rfc 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

anglemx/mexico-rfc

最新稳定版本:v1.1.1

Composer 安装命令:

composer require anglemx/mexico-rfc

包简介

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

README 文档

README

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

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

Calculate a Person's 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

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

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

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

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

https://cec.cele.unam.mx/include/howToRFC.php https://solucionfactible.com/sfic/capitulos/timbrado/rfc-clave-direfenciadora-homonimia.jsp https://solucionfactible.com/sfic/capitulos/timbrado/rfc-digito-verificador.jsp https://solucionfactible.com/sfic/capitulos/timbrado/rfc-anexos.jsp https://solucionfactible.com/sfic/resources/files/palabrasInconvenientes-rfc.pdf

统计信息

  • 总下载量: 11.2k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固