rovereto/country 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rovereto/country

Composer 安装命令:

composer require rovereto/country

包简介

Laravel Country

README 文档

README

Several methods for searching timezones, continent by country code and subdivision code by subdivision name in IP2Location.

Packagist License Packagist Downloads

Installation

Install the package via composer:

composer require rovereto/country

Usage

  1. Determining the time zone for the country and subdivision

It takes as parameters the code of the country and subdivision according to the ISO-3166 standard.

use Rovereto\Country\Concerns\TimeZone;

class MyClass
{
    use TimeZone;
    ...
}

$myClass = new MyClass();
//find time zone for Trentino-Alto Adige, Italy
//return "Europe/Rome"
$myClass->getTimeZone("IT", "IT-32");
//or
$myClass->getTimeZone("IT");

If there are several time zones in the country, when passing only the country code, returns the capital time zone.

use Rovereto\Country\Concerns\TimeZone;

class MyClass
{
    use TimeZone;
    ...
}

$myClass = new MyClass();
//find time zone for Canada
$myClass->getTimeZone("CA");
//return "America/Toronto"
  1. Determining the continent by country code

It takes as parameters the code of the country according to the ISO-3166 standard.

use Rovereto\Country\Concerns\Continent;

class MyClass
{
    use Continent;
    ...
}

$myClass = new MyClass();
//find continent for Italy
$myClass->getContinentByCountry("IT");
//return "Europe"

//find continent code for Italy
$myClass->getContinentCodeByCountry("IT");
//return "EU"

//find continent by continent code
$myClass->getContinentByCode("SA");
//return "South America"

But not all countries are on the same continent (part of the world). Russia is located in Europe and Asia. The second optional parameter with the subdivision code will allow you to define the continent for the Russian subdivision. Without a parameter, "EU" will be returned. Example:

use Rovereto\Country\Concerns\Continent;

class MyClass
{
    use Continent;
    ...
}

$myClass = new MyClass();
//find continent for Russia
$myClass->getContinentCodeByCountry("RU");
//return "EU"

//find continent for Moscow, Russia
$myClass->getContinentByCountry("RU", "RU-MOW");
//return "Europe"

//find continent for Novosibirskaya oblast', Russia
$myClass->getContinentByCountry("RU", "RU-NVS");
//return "Asia"

//find continent code for Moscow, Russia
$myClass->getContinentCodeByCountry("RU", "RU-MOW");
//return "EU"

//find continent code for Novosibirskaya oblast', Russia
$myClass->getContinentCodeByCountry("RU", "RU-NVS");
//return "AS"
  1. Map Ip2Location a subdivision name onto the code of the subdivision

Free IP geolocation database "IP2Location™ LITE" does not return ISO-3166 subdivision code. The method getSubdivisionCode finds the code subdivision by country code and subdivision name in IP2Location.

use Rovereto\Country\Concerns\Subdivision;

class MyClass
{
    use Subdivision;
    ...
}

$myClass = new MyClass();
//find subdivision code for Trentino-Alto Adige, Italy 
$myClass->getSubdivisionCode("IT", "Trentino-Alto Adige");
//return "IT-32"

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use Semantic Versioning for versioning. For the versions available, see the tags on this repository.

Changelog

Refer to the Changelog for a full history of the project.

Support

The following support channels are available at your fingertips:

Author

See also the list of contributors who participated in this project.

License

This project is licensed under the The MIT License (MIT) Massachusetts Institute of Technology License - see the LICENSE.md file for details

rovereto/country 适用场景与选型建议

rovereto/country 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 07 月 01 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 rovereto/country 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-01