1. Go to this page and download the library: Download youvision/think-regions 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/ */
use Youvision\ThinkRegions\Regions;
class Address
{
public function __construct(protected Regions $regions)
{
}
public function cities(int $provinceId): array
{
return $this->regions->getCity($provinceId);
}
}
use Youvision\ThinkRegions\Regions;
$regions = new Regions([
'table' => 'regions',
'cache' => false,
'order' => 'name asc',
]);
$provinces = $regions->getProvince();