PHP code example of tsmsogn / jp-prefecture
1. Go to this page and download the library: Download tsmsogn/jp-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/ */
tsmsogn / jp-prefecture example snippets
$hokkaido = JpPrefecture\JpPrefecture::get(1);
echo $hokkaido->getCode() . "\n";
echo $hokkaido->getName() . "\n";
var_dump(\JpPrefecture\JpPrefecture::exists(1)); // bool(true)
var_dump(\JpPrefecture\JpPrefecture::exists(48)); // bool(false)
$prefectures = JpPrefecture\JpPrefecture::all();
print_r(JpPrefecture\JpPrefecture::asList());