PHP code example of w3-devmaster / laravel-geodata

1. Go to this page and download the library: Download w3-devmaster/laravel-geodata 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/ */

    

w3-devmaster / laravel-geodata example snippets


use W3Devmaster\GeoData\GeoData;

$geodata = new GeoData();
$geographies = $geodata->geographies();
$provinces = $geodata->provinces();
$districts = $geodata->districts();
$subDistricts = $geodata->subDistricts();

// Or use static method
$geographies = GeoData::geographies();
$provinces = GeoData::provinces();
$districts = GeoData::districts();
$subDistricts = GeoData::subDistricts();


use W3Devmaster\GeoData\GeoData;

$province = GeoData::provinces()->first();

$districts = $province->districts;


use W3Devmaster\GeoData\GeoData;

$province = GeoData::provinces()->first();

$geography = $province->geography;


use W3Devmaster\GeoData\GeoData;

$provinces = GeoData::provinces()->findName('นครร')->get(); // Like Condition


$geographies = geographies();
$provinces = provinces();
$districts = districts();
$subDistricts = subDistricts();

$provinces = provinces()->findName('นครร')->get(); // Like Condition

$geo_name = geography($id)->name_th;
$province_name = province($id)->name_th;
$district_name = district($id)->name_th;
$sub_dis_name = subDistrict($id)->zip_code;

'aliases' => Facade::defaultAliases()->merge([
        // 'Example' => App\Facades\Example::class,
        ...,
        'Geo' => W3Devmaster\GeoData\Facades\Geo::class,
])->toArray(),

use Geo;

$geodata = new Geo();
// Or
$geographies = Geo::geographies();
bash
php artisan geodata:publish
bash
php artisan geodata:install