PHP code example of michaelnjuguna / kenya-administrative-divisions

1. Go to this page and download the library: Download michaelnjuguna/kenya-administrative-divisions 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/ */

    

michaelnjuguna / kenya-administrative-divisions example snippets




ichaelNjuguna\KenyaAdministrativeDivisions\KenyaAdministrativeDivisions;



// Get all county names
$countyNames = KenyaAdministrativeDivisions::getCountyNames();

// Get all constituency names
$constituencies = KenyaAdministrativeDivisions::getConstituencyNames();
$mombasaConstituencies = KenyaAdministrativeDivisions::getCounties(countyCode: 1);
$mombasaConstituencies = KenyaAdministrativeDivisions::getCounties(countyName: 'mombasa');

// Get All the data
$counties = KenyaAdministrativeDivisions::getAll();

// Get all counties
$result = KenyaAdministrativeDivisions::getCounties();

// Get county information by passing the county code
$result = KenyaAdministrativeDivisions::getCounties(countyCode: 1);

// Get county information by passing the county name
$result = KenyaAdministrativeDivisions::getCounties(countyName: 'mombasa');

// Get all constituencies
$result = KenyaAdministrativeDivisions::getConstituencies();

// Get a specific constituency information
$result = KenyaAdministrativeDivisions::getConstituencies(constituencyName: 'Changamwe');

// Get constituencies of a particular county by its code
$result = KenyaAdministrativeDivisions::getConstituencies(countyCode: 1);

// Get constituencies of a particular county by its name
$result = KenyaAdministrativeDivisions::getConstituencies(countyName: 'Mombasa');


// Get all wards
$result = KenyaAdministrativeDivisions::getWards();

// Get wards of a particular county by passing its county code
$result = KenyaAdministrativeDivisions::getWards(countyCode: 1);

// Get wards of a particular county by passing its name
$result = KenyaAdministrativeDivisions::getWards(countyName: 'Mombasa');

// Get the wards of a particular constituency by passing its name
$result = KenyaAdministrativeDivisions::getWards(constituencyName: 'Changamwe');