PHP code example of kodefarmers / nepaldata

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

    

kodefarmers / nepaldata example snippets


use KodeFarmers\NepalData\Facades\NepalData;

return NepalData::all(); // returns all data i.e provinces with its districts with its localbodies
return NepalData::all('devanagari'); // returns all data in nepali text

return NepalData::provinces(); // get all provinces
return NepalData::provinces('devanagari'); // get all provinces in nepali text

return NepalData::with('districts')->provinces(); // get all provinces with districts
return NepalData::with('districts')->provinces('devanagari'); // get all provinces with districts in nepali text

return NepalData::districts(); // get all districts
return NepalData::districts('devanagari'); // get all districts in nepali text

return NepalData::with('localbodies')->districts(); // get all districts with localbodies
return NepalData::with('localbodies')->districts('devanagari'); // get all districts with localbodies in nepali text

return NepalData::all(); // it'll return:
{
  "Province No. 1": {
    "Taplejung": {
      "Ma.Na.Pa.": [],
      "Upa.Ma.": [],
      "Na.Pa.": [
        "Taplejung(Phungling)"
      ],
      "Ga.Pa.": [
        "Sirijangha",
        "AathraiTriveni",
        "PathibharaYangwarak",
        "Meringden",
        "Sidingwa",
        "Phaktanglung",
        "MaiwaKhola",
        "MikwaKhola"
      ]
    },
    .
    .