PHP code example of kusaasira / uganda-geo

1. Go to this page and download the library: Download kusaasira/uganda-geo 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/ */

    

kusaasira / uganda-geo example snippets


use Uganda\Uganda;

$uganda = new Uganda();

# Retrieve all districts
$districts = $uganda->districts();

# Retrieve all counties in a particular district
$counties = $uganda
    ->district('Mukono')
    ->counties();

# Retrieve all sub counties in a particular district
$subCounties = $uganda
    ->district('Mukono')
    ->subCounties();


# Retrieve all parishes in a particular district
$parishes = $uganda
    ->district('Mukono')
    ->parishes();

# Retrieve all villages in a particular district
$villages = $uganda
    ->district('Mukono')
    ->villages();

use Uganda\Uganda;

$uganda = new Uganda();

# Retrieve all counties
$counties = $uganda->counties();

# Retrieve specific county
$county = $uganda->county('Adjumani West County');

# Retrieve all sub counties in a particular county
$subCounties = $uganda
    ->county('Adjumani West County')
    ->subCounties();

# Retrieve all parishes in a particular county
$parishes = $uganda
    ->county('Adjumani West County')
    ->parishes();

# Retrieve all villages in a particular county
$villages = $uganda
    ->county('Adjumani West County')
    ->villages();

use Uganda\Uganda;

$uganda = new Uganda();

# Retrieve all sub counties
$subCounties = $uganda->subCounties();

# Retrieve specific sub county
$subCounty = $uganda->subCounty('Namasale Town Council');

# Retrieve all parishes in a particular sub county
$parishes = $uganda
    ->county('Namasale Town Council')
    ->parishes();

# Retrieve all villages in a particular sub county
$villages = $uganda
    ->county('Namasale Town Council')
    ->villages();

use Uganda\Uganda;

$uganda = new Uganda();

# Retrieve all parishes
$parishes = $uganda->parishes();

# Retrieve specific parish
$parish = $uganda->parish('Bunamwamba');

# Retrieve all villages in a particular parish
$villages = $uganda
    ->county('Bunamwamba')
    ->villages();

use Uganda\Uganda;

$uganda = new Uganda();

# Retrieve all villages
$villages = $uganda->villages();

# Retrieve specific village
$subCounty = $uganda->village('Ayeye');