Package Data | |
---|---|
Maintainer Username: | Sukohi |
Maintainer Contact: | capilano.sukohi@gmail.com (Sukohi) |
Package Create Date: | 2014-10-17 |
Package Last Update: | 2015-08-11 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:10:41 |
Package Statistics | |
---|---|
Total Downloads: | 9 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
A PHP package mainly developed for Laravel to manage Japanese prefectures.
Note: This package was integrated into Wafu.
After installation using composer, add the followings to the array in app/config/app.php
'providers' => array(
...Others...,
'Sukohi\JapanesePrefectures\JapanesePrefecturesServiceProvider',
)
Also
'aliases' => array(
...Others...,
'JapanesePrefectures' =>'Sukohi\JapanesePrefectures\Facades\JapanesePrefectures',
)
$prefectures = JapanesePrefectures::prefectures();
print_r($prefectures);
echo JapanesePrefectures::prefectureName(1); // 北海道
echo JapanesePrefectures::prefectureId('兵庫県'); // 28
$regions = JapanesePrefectures::regions();
print_r($regions);
echo JapanesePrefectures::regionName(3); // 関東
echo JapanesePrefectures::regionId('東北'); // 2
$region_prefecture_ids = JapanesePrefectures::regionPrefectureIds();
print_r($region_prefecture_ids);
Example
foreach ($region_prefecture_ids as $region_id => $prefecture_ids) {
echo '<strong>'. JapanesePrefectures::regionName($region_id) .'</strong><br>';
foreach ($prefecture_ids as $prefecture_id) {
echo ' '. JapanesePrefectures::prefectureName($prefecture_id) .'<br>';
}
}