This is a laravel package you can use to retrieve population data for Uganda's regions, districts, subcounties and population according to the 2014 census data
This package lets you to access population statistics such as male/female population, gender ratio, land area and population density associated with regions, districts or subcounties within Uganda
In order to run this project, ensure that you have installed;
- PHP 5.3 or later
- Composer
Follow these steps to install and setup the package within your project
Pull this package in through Composer
composer require jaymeskat/ug-geog
-
Laravel 5.5 + Uses package auto discovery features to recognise the package.
-
Laravel 5.4 and below Add the package to your application service providers in
config/app.php
file.
'providers' => [
...
/**
* Package Service Providers...
*/
JaymesKat\UgGeog\UgGeogServiceProvider::class,
],
Publish the package to your application if required by running this command in your terminal.
php artisan vendor:publish --provider="JaymesKat\UgGeog\UgGeogServiceProvider"
Ensure all package classes are autoloaded
composer dump-autoload
Set up seeding by adding the code below in the body of the run
function inside the DatabaseSeeder.php
file located within the database/seeds
folder
$this->call(RegionsTableSeeder::class);
Run migrations to provision tables in your database, this will also add seed data to tables.
php artisan migrate --seed
Use models from package to get the records.
use JaymesKat\UgGeog\Models\Region;
$regionsArray = Region::list();
use JaymesKat\UgGeog\Models\District;
$districtsArray = District::list();
use JaymesKat\UgGeog\Models\Subcounty;
$subcountiesArray = Subcounty::list();
Use the package models to retrieve specific region, district or subcounty information.
use JaymesKat\UgGeog\Models\Region;
use JaymesKat\UgGeog\Models\District;
use JaymesKat\UgGeog\Models\Subcounty;
$region = Region::get('Central');
$district = District::get('Kampala');
$subcounty = Subcounty::get('Bihanga');
// Get all districts within a region
$districtsWithinRegion = District::inRegion('Western');
// Get all subcounties within a district
$subcountiesWithinDistrict = Subcounty::inDistrict('Jinja');
The data used in this package was published by Uganda Bureau Of Statistics on data.ug
I welcome comments for improvements on this package. Please document this by creating an issue
This package is free software distributed under the terms of the MIT license.