plutuss/laravel-geonames-api
Composer 安装命令:
composer require plutuss/laravel-geonames-api
包简介
The Laravel Geonames API package provides an easy way to integrate the Geonames API into your Laravel application. This package enables developers to effortlessly interact with the Geonames API to retrieve geographic data such as cities, countries, coordinates, time zones, and other location-based i
关键字:
README 文档
README
Laravel:
Note
The Laravel Geonames API package provides an easy way to integrate the Geonames API into your Laravel application. This package enables developers to effortlessly interact with the Geonames API to retrieve geographic data such as cities, countries, coordinates, time zones, and other location-based information.
- Key Features
- Geonames API Requests: Simple method to send requests and handle responses from the Geonames API.
- Support for Various Query Types: Supports all major query types including name searches, reverse geocoding, and more.
- Configuration: Easy setup of API credentials and other parameters through a configuration file.
- Laravel Compatibility: Full integration with the Laravel ecosystem, including support for Service Providers and Facades.
composer require plutuss/geo-names-laravel
php artisan vendor:publish --provider="Plutuss\GeoNames\Providers\GeoNamesServiceProvider"
# .env GEO_NAMES_USERNAME=user_name
Use Facade GeoName
$response = GeoName::postalCodeSearchJSONFromName('city_name'); $response = GeoName::setPostalCode(6600) ->setCountryCode('CH') ->postalCodeSearchJSONFromName('city_name'); // OR $response = GeoName::setOption([ 'country' => 'CH', ])->postalCodeSearchJSONFromName('city_name');
$response = GeoName::postalCodeSearchJSONFromPostCode(6600); $response = GeoName::setCountryCode('CH') ->postalCodeSearchJSONFromPostCode(6600); // OR $response = GeoName::setOption([ 'country' => 'CH', ])->postalCodeSearchJSONFromPostCode('6600');
setCountryCode(string $countryCode): static; setPostalCode(int $value): static; setPostalCodeStartsWith(string $value): static; setPlaceName(string $value): static; setPlaceNameStartsWith(string $value): static; setCountry(string $value): static; setCountryBias(string $value): static; setMaxRows(int $value): static; setStyle(string $value): static; setOperator(string $value): static; setCharset(string $value): static; setIsReduced(bool $value): static; setEast(float $value): static; setWest(float $value): static; setNorth(float $value): static; setSouth(float $value): static; setLatitude(string $value): static; setLongitude(string $value): static; setRadius(int $value): static;
setOption(array $params): static;
searchJSON(string $country): JsonResponse|array|Collection; postalCodeSearchJSONFromPostCode(int $postalCode, int $radius = 5, int $maxRows = 10): JsonResponse|array|Collection; postalCodeSearchJSONFromName(string $name, int $radius = 5, int $maxRows = 10): JsonResponse|array|Collection; findNearbyPostalCodes(int $lat, int $lng): JsonResponse|array|Collection; postalCodeCountryInfo(): JsonResponse|array|Collection; findNearbyJSON(int $lat, int $lng): JsonResponse|array|Collection;
Response
latitude(): mixed; getCollectionData(): Collection; getArrayData(): array; longitude(): mixed; placeName(): mixed; postalCode(): mixed; countryCode(): mixed; region(): mixed; land(): mixed; // The getNestedValue() method retrieves a value // from a deeply nested array using "dot" notation // $response->getNestedValue('key.array') getNestedValue($path, $default = null): mixed;
plutuss/laravel-geonames-api 适用场景与选型建议
plutuss/laravel-geonames-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 86 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 07 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「geocoding」 「api」 「geolocation」 「geography」 「laravel」 「countries」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 plutuss/laravel-geonames-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 plutuss/laravel-geonames-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 plutuss/laravel-geonames-api 相关的其它包
同方向 / 同关键字的高下载量 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.
The official PHP library for apiip.net that allowing customers to automate IP address validation and geolocation lookup in websites, applications and back-office system. Visit our API docs at https://apiip.net/documentation
Laravel integration for Nominatim Geocoding API Client
A PSR-7 compatible library for making CRUD API endpoints
统计信息
- 总下载量: 86
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-08