1. Go to this page and download the library: Download bvp/prefecture 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/ */
/**
* @deprecated It returns only a single result even if multiple prefectures match. Use Prefecture::byRegionNumberList() instead.
* @return array|null
*/
$prefecture = Prefecture::byRegionNumber(3);
// or $prefecture = Prefecture::byRegionNumber([3]);
/**
* @deprecated It returns only a single result even if multiple prefectures match. Use Prefecture::byRegionNameList() instead.
* @return array|null
*/
$prefecture = Prefecture::byRegionName('関東地方');
// or $prefecture = Prefecture::byRegionName(['関東地方']);
/**
* @deprecated It returns only a single result even if multiple prefectures match. Use Prefecture::byRegionShortNameList() instead.
* @return array|null
*/
$prefecture = Prefecture::byRegionShortName('関東');
// or $prefecture = Prefecture::byRegionShortName(['関東']);