PHP code example of hejunjie / china-division

1. Go to this page and download the library: Download hejunjie/china-division 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/ */

    

hejunjie / china-division example snippets



use Hejunjie\ChinaDivision\Division;

// Retrieve current data
$data = Division::getData();

// Retrieve historical data
$history = Division::getHistory();

// Retrieve change records
$diff = Division::getDiff();


use Hejunjie\ChinaDivision\Division;

// Retrieve province, city, and district information based on the ID card number
$info = Division::getAddressInfo('11010119960124993X');

// Convert to a data format suitable for cascading selectors (for front-end province-city-district linkage components)
$cascaderData = Division::convertToCascaderData();

// Retrieve gender information based on the ID card number
$sex = Division::getGenderFromIdCard('11010119960124993X');

// Validate ID card information
$isValid = Division::isValidIdCard('11010119960124993X');

// Retrieve the birth date (year, month, day) based on the ID card number
$birthday = Division::getBirthdayFromIdCard('11010119960124993X');

// Retrieve city data by levels (level_1, level_2, level_3)
$level = Division::getCityLevels();