sportscar03 / psgc-database
(Customized) This is a simple CLI tool to easily add Philippine Standard Geographic Code (PSGC) data to your database.
Fund package maintenance!
Jeric June Logan
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0
- spatie/laravel-package-tools: ^1.16
- spatie/simple-excel: ^3.6
- symfony/dom-crawler: ^7.1
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
This package is not auto-updated.
Last update: 2025-08-18 22:52:35 UTC
README
A Laravel package to import the Philippine Standard Geographic Code (PSGC) into your database with optimized structure for regions, provinces, cities/municipalities, and barangays.
Installation
You can install the package via composer:
composer require sportscar03/psgc-database:dev-main
You can publish the config file with:
php artisan vendor:publish --tag="psgc-database-config"
This will create a config file:
<?php return [ 'source' => public_path('psgc/latest.xlsx'), ];
Usage
Step 1: Publish and run the migrations
php artisan vendor:publish --tag="psgc-database-migrations"
php artisan migrate
Step 2: Download the latest PSGC data
php artisan psgc-db:download
This will download the latest PSGC Excel file and save it to your storage/public
directory.
Step 3: Convert the Excel file into tables
php artisan psgc-db:convert
This will parse the Excel file and insert the data into the following tables:
regions
provinces
cities
barangays
License
This package is open-sourced software licensed under the MIT license.