定制 geradrum/php-curp-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

geradrum/php-curp-generator

最新稳定版本:0.1.3

Composer 安装命令:

composer require geradrum/php-curp-generator

包简介

CURP generator

README 文档

README

Overview

The Curp class is designed to generate a CURP (Clave Única de Registro de Población) in Mexico based on the provided personal information. This class validates the required fields and constructs the CURP accordingly.

Requirements

The class requires the following fields in the input data array:

  • name: First name of the individual.
  • lastname: Last name of the individual.
  • maternal_lastname: Maternal last name (optional).
  • birthdate: Birthdate in the format YYYY-MM-DD.
  • entity: Entity object containing the corresponding state or entity information.
  • gender: Gender of the individual.

Example Usage

To use the Curp class, you need to create an instance of it with the required data. Below is an example of how to instantiate the class and generate a CURP.

Example

<?php

use Geradrum\Curp\Curp;
use Geradrum\Curp\Models\Entity;
use Geradrum\Curp\Models\Gender;

try {
    // Instantiate the Curp class
    $curp = new Curp([
        'name' => 'Juan',
        'lastname' => 'Pérez',
        'maternal_lastname' => 'García',
        'birthdate' => '1990-05-15',
        'entity' => Entity::JALISCO,
        'gender' => Gender::MALE,
    ], [ // Optional parameter
        'verification_digits' => true, // Set false to keep verification digits as XX
    ]);

    // Output the generated CURP
    echo "Generated CURP: " . $curp->getCurp() . "\n";
} catch (InvalidArgumentException $e) {
    echo "Error: " . $e->getMessage();
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-11