承接 aternus/geonames-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

aternus/geonames-client

Composer 安装命令:

composer require aternus/geonames-client

包简介

GeoNames API Client

README 文档

README

A GeoNames API Client for PHP.

validate

Install with confidence 🛡️

  • Supported OS: Linux, macOS and Windows.
  • Supported PHP versions: 7.2 and up.

Quick Start

An overview of available API parameters for each endpoint is available here.

<?php

use GeoNames\Client as GeoNamesClient;

$g = new GeoNamesClient('username');

// get a list of supported endpoints
$endpoints = $g->getSupportedEndpoints();

// get info for country
// note that I'm using the array destructor introduced in PHP 7.1
[$country] = $g->countryInfo([
    'country' => 'IL',
    'lang'    => 'ru', // display info in Russian
]);

// country name (in Russian)
$country_name = $country->countryName;

// spoken languages (ISO-639-1)
$country_languages = $country->languages;

Client Options

Supported client options:

  1. username: GeoNames username.
  2. token?: GeoNames token (i.e. premium user key).
  3. api_url?: URL of the GeoNames web service.
  4. connect_timeout?: HTTP Client connection timeout. The number of seconds to wait while trying to connect to a server (default 0, wait indefinitely).
  5. fallback_api_url: COMING SOON.
  6. fallback_api_url_trigger_count: COMING SOON.

Example: Providing options during instantiation

$g = new GeoNamesClient('username', '', ['api_url' => 'https://custom-premium.geonames.org']);

Example: Changing options during runtime

$g = new GeoNamesClient('username');
$g->setOptions(['api_url' => 'https://custom-premium.geonames.org'])

Why?

This library will allow you to get better insights into the world.

As a developer and a multilingual speaker I've always felt that localization was put on last priority since it was so time-consuming and error-prone.

Getting statistics for each country is a painful process that requires understanding the different ISO standards, and even then you're still left to piece the puzzle together yourself.

Luckily, GeoNames have been collecting statistical data about the world for the past few decades and offers that data via their API.

The aim of this library is to provide a single source of truth for country (ISO-3166), language (ISO-639-1), and other locale related statistical data, so that other developers can write better software which is up-to-date with the latest changes in the world.

Installation

If you're using Composer to manage dependencies:

composer require aternus/geonames-client

Then, after running composer update, you can load the class using Composer's autoloading:

require 'vendor/autoload.php';

Otherwise, you can simply require the file directly:

require_once 'vendor/aternus/geonames-client/src/Client.php';

And in either case, I'd suggest using an alias.

use GeoNames\Client as GeoNamesClient;

Other Useful Libraries

Please make sure to implement some kind of cache mechanism in order to save yourself time, bandwidth and be respectful to GeoNames for providing all that data for free.

If you're making heavy use of the statistical data, you can subscribe to their Premium Data plan.

License

Released under the MIT License - see LICENSE.md for details.

Credits

David Jean Louis for the PEAR package which inspired this GeoNames API Client.

aternus/geonames-client 适用场景与选型建议

aternus/geonames-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 224.19k 次下载、GitHub Stars 达 36, 最近一次更新时间为 2018 年 08 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「database」 「api」 「geographical」 「countries」 「languages」 「geonames」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 aternus/geonames-client 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 224.19k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 38
  • 点击次数: 22
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 36
  • Watchers: 5
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-27