Skip to content

πŸ“ Simplify location selection with this TypeScript library for Philippine regions, cities, and municipalities. Perfect for forms and search filters.

Notifications You must be signed in to change notification settings

godkirahere/ph-regions-cities-municipalities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ ph-regions-cities-municipalities - Easy Location Mapping for the Philippines

Download Now

This simple library helps you find Philippine regions, cities, and municipalities. Perfect for dropdown menus, forms, and search filters in your applications.


πŸš€ Getting Started

To start using the ph-regions-cities-municipalities library, follow these steps:

  1. Visit the Releases page to download.
  2. Choose the latest version.
  3. Download the package that suits your needs.

πŸ“¦ Download & Install

You can easily add this library to your project.

Using npm

Open your terminal and run:

npm install ph-regions-cities-municipalities

Using Yarn

If you're using Yarn, run:

yarn add ph-regions-cities-municipalities

πŸ› οΈ How to Use

Once you've installed the library, you can start using it in your project.

Importing the Library

Add the following line at the top of your TypeScript file:

import locations from "ph-regions-cities-municipalities";

Fetching All Regions

You can retrieve all regions easily. Use the following code:

console.log(locations.states);
/*
Output example:
[
  {
    iso2: 'PH104200000',
    name: 'Misamis Occidental',
    id: 0
  }
]
*/

Getting Cities by Province Code

If you need to get cities from a specific province, use the province code:

const provinceCode = "PH104200000"; // Example for Misamis Occidental
console.log(locations.statesMap[provinceCode]);
/*
Output example:
[
  {
    id: 0,
    name: 'Ozamis City'
  }
]
*/

🏑 How It Works

This library provides a structured map of Philippine regions, cities, and municipalities. Each state contains an identifier, name, and an array of cities. You can use this data in various applications, such as forms or search filters, to improve user experience.

πŸ“‘ Example Use Case

Imagine you want to create a registration form that asks users for their addresses. You can use this library to populate a dropdown with regions and corresponding cities.

  1. When the user selects a region, you can fetch the cities associated with that region.
  2. The user then chooses their city from the updated list.

This provides a simple and clear way to input location data.

πŸ” Features

  • Comprehensive Dataset: Contains all Philippine regions and their respective cities and municipalities.
  • Easy Integration: Simple to add to your existing TypeScript projects.
  • Dynamic Updates: Automatically updates to include new regions or cities, ensuring your application uses the most current data.

πŸ“ Troubleshooting

If you encounter issues:

  • Ensure you have a stable internet connection while downloading.
  • Verify that you have the necessary permissions to install packages if you are using a work computer.
  • Make sure you are using compatible versions of npm or Yarn.

πŸ“ž Support

For any questions or support, feel free to open an issue in the GitHub repository.


Download Now

About

πŸ“ Simplify location selection with this TypeScript library for Philippine regions, cities, and municipalities. Perfect for forms and search filters.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •