承接 cromwell/iso3166 相关项目开发

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

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

cromwell/iso3166

最新稳定版本:1.0

Composer 安装命令:

composer require cromwell/iso3166

包简介

A simple package for working with ISO-3166 country codes

README 文档

README

Scrutinizer Code Quality Build Status Code Climate Test Coverage

Package for interacting with ISO3166 country codes

Example Usage

$iso = new \Cromwell\ISO3166\Countries();

$iso[$iso::UNITED_KINGDOM]->name;

The above isn't hugely useful, it gets more interesting when the code has been stored and retrieved from persistence:

$iso = new \Cromwell\ISO3166\Countries();

$iso[$customer->country]->name;

You can also use jsonSerialize() either for JSON encoding or as a convenient way to get a multidimensional array for use to construct a <select> box of code => name.

Subsets

You can construct any subset of countries by passing an array of codes. The package contains an EU subset at the moment, you can use the EU class as an example of how to do it or if you just wanted EU countries, there you go.

Passing an array of codes is useful if they've been selected on the fly by an end user. It could be a list of countries that they ship to, for example. In this instance it's likely to change between customers or be initialised from the database. If it's a static list, such as a continent or EU membership, use the EU example and extend the base Countries class to implement your subset.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-10-10