luiscamp/laravel-peru-ubigeo
最新稳定版本:v0.1.2
Composer 安装命令:
composer require luiscamp/laravel-peru-ubigeo
包简介
Peruvian ubigeo utilities for Laravel applications.
README 文档
README
Base package to work with Peruvian ubigeo data in Laravel.
Installation
composer require luiscamp/laravel-peru-ubigeo
Quick start after install
# 1) Publish migration php artisan vendor:publish --tag=ubigeo-migrations # 2) Run migrations php artisan migrate # 3) Publish seeder php artisan vendor:publish --tag=ubigeo-seeders # 4) Seed ubigeo data php artisan db:seed --class="Database\\Seeders\\UbigeoSeeder"
Publish config
php artisan vendor:publish --tag=ubigeo-config
Publish migrations
php artisan vendor:publish --tag=ubigeo-migrations php artisan migrate
Publish model + migration (single command)
php artisan ubigeo:publish
Options:
php artisan ubigeo:publish --modelphp artisan ubigeo:publish --migrationphp artisan ubigeo:publish --force
Publish and run seeder
php artisan vendor:publish --tag=ubigeo-seeders
php artisan db:seed --class="Database\\Seeders\\UbigeoSeeder"
API endpoints
By default the prefix is ubigeo and middleware is api.
GET /ubigeo/search?code=010000 GET /ubigeo/search?name=lima GET /ubigeo/departments?name=ama GET /ubigeo/provinces/010000?name=chacha GET /ubigeo/districts/010100?name=asuncion
Rules:
- Department code: ends with
0000(example010000). - Province code: ends with
00and excludes departments (example010100). - District responses return
id(notcode).
Trait methods
use LaravelPeru\Ubigeo\Traits\InteractsWithUbigeo; class UbigeoService { use InteractsWithUbigeo; }
Available methods:
getDepartament(?string $name = null)getProvice(string $code, ?string $name = null)getDistrict(string $code, ?string $name = null)
Testing
composer test
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-12