Local States Nepal(Data Set and PHP Library)

Previously, we had 14 zones, 75 districts, 58 municipalities and 3157 VDCs in Nepal. In 2017, This was restructured into 7 provinces, 77 districts, 753 municipalities and 6,743 wards in Nepal. Now, there is a major change when it comes to official addressing. Here, we will discuss about open source data set and PHP library to get local level data in well structured way.

All data are collected from wikipedia and various Nepal government sites. Data set is available in Nepali and English format for provinces, districts, municipalities and their wards. You can find all these things in following github repository.

https://github.com/sagautam5/local-states-nepal

Now, we will discuss about how we can add this package in php applications. At first you have to run the following command to include this package via Composer,

composer require sagautam5/local-states-nepal
 

Currently, no mandatory configuration is required for using this package. We have used English as the default language and if you want Nepali you have to specify the language while using this package.

That’s all. It’s pretty simple to setup, isn’t it ?

Let’s learn about basic usage of this package.

<?php

use Sagautam5\LocalStateNepal\Entities\Municipality;

$municipality = new Municipality();

By default, English language will be used and we will get data in English format. We can specify the language when we initialize the class object.

$municipality = new Municipality('np');

Here, corresponds to Nepali.

We can retrieve list of all municipalities like this:

$municipalityList = $municipality->allMunicipalities();
 

You can see more detail documentation of each entity in the links provided in following list.

  1. Provinces
  2. Districts
  3. Municipality
  4. Category

This package includes basic features like find, find by, listing as well as advance features like search, interrelated data and many more.

If you use different language than php, you can still use data set available here: https://github.com/sagautam5/local-states-nepal/tree/master/dataset in JSON format and use this data in your project.

DEMO(English): https://stacklearning.com/local-state-demo
DEMO(नेपाली): https://stacklearning.com/local-state-demo-np


share :

Sagar Gautam

A Computer Engineer from Nepal.


Leave your Feedback