geocodefarm/geocodefarm-php
Composer 安装命令:
composer require geocodefarm/geocodefarm-php
包简介
Geocode.Farm SDK for PHP
README 文档
README
A lightweight, dependency-free PHP SDK for interacting with the Geocode.Farm geocoding API.
This SDK allows developers to easily perform forward (address to coordinates) and reverse (coordinates to address) geocoding using a simple object-oriented interface.
📦 Installation
You can install the SDK via Composer:
composer require geocodefarm/geocodefarm-php
🚀 Quick Start
<?php require 'vendor/autoload.php'; use GeocodeFarm\GeocodeClient; // Initialize the client with your API key $client = new GeocodeClient('YOUR_API_KEY'); // Forward geocoding: address to lat/lon $response = $client->forward('30 N Gould St, Sheridan, WY'); print_r($response); // Reverse geocoding: lat/lon to address $response = $client->reverse(44.797773, -106.954918); print_r($response);
✅ Response Format
Both methods (forward() and reverse()) return an array like this on success:
[
'success' => true,
'status_code' => 200,
'lat' => 44.797773,
'lon' => -106.954918,
'accuracy' => 'EXACT_MATCH',
'full_address' => '30 N Gould St, Sheridan, WY 82801',
'result' => [
'house_number' => '30',
'street_name' => 'N Gould St',
'locality' => 'Sheridan',
'admin_2' => 'Sheridan County',
'admin_1' => 'WY',
'country' => 'United States',
'postal_code' => '82801',
'formatted_address' => '30 N Gould St, Sheridan, WY 82801',
'latitude' => 44.797773,
'longitude' => -106.954918,
'accuracy' => 'EXACT_MATCH'
]
]
If an error occurs:
[
'success' => false,
'status_code' => 403,
'error' => 'API returned failure: INVALID_KEY'
]
📝 License
This SDK is released under The Unlicense — public domain. Use it freely.
🤝 Contributing
Pull requests and issues are welcome!
🌐 About
For more information about the geocoding API, visit https://geocode.farm.
geocodefarm/geocodefarm-php 适用场景与选型建议
geocodefarm/geocodefarm-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 04 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「geocoding」 「api」 「address」 「geocode」 「geocodefarm」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 geocodefarm/geocodefarm-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 geocodefarm/geocodefarm-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 geocodefarm/geocodefarm-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Maps in minutes. Powered by the Google Maps API.
Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.
GISCO Geocoding Provider for Geocoder PHP.
Laravel integration for Nominatim Geocoding API Client
A PSR-7 compatible library for making CRUD API endpoints
Google Maps PHP SDK.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unlicense
- 更新时间: 2025-04-04