承接 rapidwebltd/php-countries 相关项目开发

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

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

rapidwebltd/php-countries

Composer 安装命令:

composer require rapidwebltd/php-countries

包简介

PHP Countries is a library that provides an elegant syntax to country data.

README 文档

README

Build Status Coverage Status StyleCI

PHP Countries is a library that provides an elegant syntax to country data.

Installation

You can install PHP Countries via Composer, as follows.

composer require rapidwebltd/php-countries

Usage

To use PHP Countries, you must create a new Countries object.

use RapidWeb\Countries\Countries;

$countries = new Countries;

You can then call various methods on this object, to get country data.

Retrieving all countries

You can easily retrieve an array of all countries and iterate through them, as follows.

foreach($countries->all() as $country) {
    var_dump($country->name.' - '.$country->officialName);
}

Retrieving country by name

Country details can be retrieved from the country's official or common name.

var_dump($countries->getByName('United Kingdom'));

/* 
object(RapidWeb\Countries\Country)#4869 (16) {
  ["name"]=>
  string(14) "United Kingdom"
  ["officialName"]=>
  string(52) "United Kingdom of Great Britain and Northern Ireland"
  ["topLevelDomains"]=>
  array(1) {
    [0]=>
    string(3) ".uk"
  }
  ["isoCodeAlpha2"]=>
  string(2) "GB"
  ["isoCodeAlpha3"]=>
  string(3) "GBR"
  ["isoCodeNumeric"]=>
  string(3) "826"
  ["languages"]=>
  array(1) {
    [0]=>
    string(7) "English"
  }
  ["languageCodes"]=>
  array(1) {
    [0]=>
    string(3) "eng"
  }
  ["currencyCodes"]=>
  array(1) {
    [0]=>
    string(3) "GBP"
  }
  ["callingCodes"]=>
  array(1) {
    [0]=>
    string(2) "44"
  }
  ["capital"]=>
  string(6) "London"
  ["region"]=>
  string(6) "Europe"
  ["subregion"]=>
  string(15) "Northern Europe"
  ["latitude"]=>
  int(54)
  ["longitude"]=>
  int(-2)
  ["areaInKilometres"]=>
  int(242900)
}
*/

Retrieving country by ISO 3166-1 code

You can get the data for a country by its ISO 3166-1 code. The 2 character, 3 character and numeric variations are all accepted.

var_dump($countries->getByIsoCode('USA'));

/*
object(RapidWeb\Countries\Country)#4693 (16) {
  ["name"]=>
  string(13) "United States"
  ["officialName"]=>
  string(24) "United States of America"
  // etc...
}
*/

Retrieving country by language spoken

Providing a language, will return an array of all countries in which that language is spoken. You can provide a language name or code.

var_dump($countries->getByLanguage('German'));

/*
array(5) {
  [0]=>
  object(RapidWeb\Countries\Country)#4913 (16) {
    ["name"]=>
    string(7) "Belgium"
    ["officialName"]=>
    // etc...
  }
  [1]=>
  object(RapidWeb\Countries\Country)#4883 (16) {
    ["name"]=>
    string(7) "Germany"
    ["officialName"]=>
    string(27) "Federal Republic of Germany"
    // etc...
  }
  [2]=>
  object(RapidWeb\Countries\Country)#4826 (16) {
    ["name"]=>
    string(13) "Liechtenstein"
    ["officialName"]=>
    string(29) "Principality of Liechtenstein"
    // etc...
  }
  [3]=>
  object(RapidWeb\Countries\Country)#4808 (16) {
    ["name"]=>
    string(10) "Luxembourg"
    ["officialName"]=>
    string(25) "Grand Duchy of Luxembourg"
    // etc...
  }
  [4]=>
  object(RapidWeb\Countries\Country)#4871 (16) {
    ["name"]=>
    string(7) "Namibia"
    ["officialName"]=>
    string(19) "Republic of Namibia"
    // etc...
  }
}
*/

rapidwebltd/php-countries 适用场景与选型建议

rapidwebltd/php-countries 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.49k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2017 年 09 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 rapidwebltd/php-countries 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 7.49k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-only
  • 更新时间: 2017-09-14