peergum/geodb
Composer 安装命令:
composer require peergum/geodb
包简介
Provides Laravel with geographical databases and APIs
关键字:
README 文档
README
Laravel GeoDB
A Laravel package providing geographical information to your site
Current Version: 1.1;
Description
Laravel GeoDB provides your laravel app with a simple way to list countries, states, cities, their geolocation or a combination thereof, without requiring the implementation of a Google or OpenStreetMaps API.
You can access the information directly from your code, through a Facade, or from any reactive view, using internal APIs.
Note that the space used by the database (around 1.6GB for 4.5M cities in 252 countries) may end costing you more than the monthly fees charged by Google. Google may also provide you with better or more accurate results.
Status
This package is a work in progress. Please come back soon for more.
Installation
1. Add package
run composer require peergum/geodb "^1.1" in yor laravel site folder
2. Setup package
Run art migrate to install the geodb tables, then:
- For a full install (all countries), run install script:
art geodb:installorart geodb:install all - For a partial install (just a few countries), run with parameters: e.g.
art geodb:install fr gb usto install cities for France, Great Britain and USA.
Depending on the number and size of chosen countries, and your server connectivity and speed, download and install can take between a few seconds and much longer. If you request "ALL" in upper case, the install will download and unzip one file with a final size of 1.6GB. If you type "all" in lower case, it will require each country file separately. All downloaded files, zipped and unzipped, are kept under the storage/geodb folder for future re-runs. The -U or --update option can be passed to force a redownload of the requested countries/files.
3. Update caches
If you're using Inertia, re-run npm run build in order to update your vite cache.
4. Check status
Go to /geodb on your site, to confirm number of countries, states and cities loaded.
If you have inertia/vue installed, you can also use the city search field in the page to check how fast the response time is (depending on your
DB server and connectivity)
Screenshot without Vue (partial load):

Screenshot after Breeze install (partial load):

ChangeLog
See here
License: Apache2
Author: Phil Hilger AKA "PeerGum"
About Me:
peergum/geodb 适用场景与选型建议
peergum/geodb 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 11 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「laravel」 「states」 「countries」 「cities」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 peergum/geodb 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 peergum/geodb 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 peergum/geodb 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP extension with Brazilian states and formats for CPF, CNPJ and ZIP
A simple PHP class for United States Postal Service (USPS) addresses
A PSR-7 compatible library for making CRUD API endpoints
Convert and operate with FIPS codes for states, counties, etc.
PHP Countries and Currencies
Laravel 5.* Library for Malaysian states list
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2023-11-29
