baironbernal/colombia-locations 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

baironbernal/colombia-locations

Composer 安装命令:

composer require baironbernal/colombia-locations

包简介

Paquete con todos los departamentos y municipios de Colombia para Laravel

README 文档

README

A Laravel package that provides all 33 departments and 1,122+ municipalities of Colombia, based on official DANE (Departamento Administrativo Nacional de Estadística) codes.

Requirements

  • PHP 8.1+
  • Laravel 10, 11, or 12

Installation

Install the package via Composer:

composer require baironbernal/colombia-locations

Laravel will automatically discover the service provider. Then run the migrations:

php artisan migrate

Finally, seed the database with all Colombian departments and municipalities:

php artisan db:seed --class="BaironBernal\ColombiaLocations\Database\Seeders\ColombiaLocationsSeeder"

Database Structure

departments table

Column Type Description
id bigint (PK) Auto-incremental primary key
code varchar(2) Official DANE code (e.g. "05")
name varchar(100) Department name (e.g. "Antioquia")

municipalities table

Column Type Description
id bigint (PK) Auto-incremental primary key
code varchar(5) Official DANE code (e.g. "05001")
name varchar(150) Municipality name (e.g. "Medellín")
department_id bigint (FK) Foreign key to departments.id

About DANE codes: The municipality code is formed by the 2-digit department code + 3 digits for the municipality. For example, 05001 = Medellín (05 = Antioquia, 001 = Medellín).

Usage

The package ships with two Eloquent models you can use directly.

Get all departments

use BaironBernal\ColombiaLocations\Models\Department;

$departments = Department::all();

Get all municipalities of a department

use BaironBernal\ColombiaLocations\Models\Department;

$antioquia = Department::where('code', '05')->first();
$municipalities = $antioquia->municipalities;

Get a municipality with its department

use BaironBernal\ColombiaLocations\Models\Municipality;

$medellin = Municipality::where('code', '05001')->first();
echo $medellin->name;              // "Medellín"
echo $medellin->department->name;  // "Antioquia"

Search municipalities by name

use BaironBernal\ColombiaLocations\Models\Municipality;

$results = Municipality::where('name', 'like', '%bogotá%')->get();

Get departments with their municipalities eager loaded

use BaironBernal\ColombiaLocations\Models\Department;

$departments = Department::with('municipalities')->get();

Publishing Assets

If you want to customize the migrations or seeders, you can publish them to your project:

# Publish migrations
php artisan vendor:publish --tag=colombia-locations-migrations

# Publish seeders
php artisan vendor:publish --tag=colombia-locations-seeders

Data Coverage

Department Municipalities
Antioquia 125
Atlántico 23
Bogotá D.C. 1
Bolívar 46
Boyacá 123
Caldas 27
Caquetá 16
Cauca 42
Cesar 25
Chocó 31
Córdoba 30
Cundinamarca 116
Huila 37
La Guajira 15
Magdalena 30
Meta 29
Nariño 64
Norte de Santander 40
Quindío 12
Risaralda 14
Santander 87
Sucre 26
Tolima 47
Valle del Cauca 42
Arauca 7
Casanare 19
Putumayo 13
San Andrés y Providencia 2
Amazonas 11
Guainía 9
Guaviare 4
Vaupés 6
Vichada 4

License

This package is open-sourced software licensed under the MIT license.

baironbernal/colombia-locations 适用场景与选型建议

baironbernal/colombia-locations 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 baironbernal/colombia-locations 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 baironbernal/colombia-locations 我们能提供哪些服务?
定制开发 / 二次开发

基于 baironbernal/colombia-locations 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 31
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-11