PHP code example of geradrum / php-curp-generator
1. Go to this page and download the library: Download geradrum/php-curp-generator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
geradrum / php-curp-generator example snippets
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();
}