PHPackages                             rovereto/country - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rovereto/country

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rovereto/country
================

Laravel Country

v1.0.0(4y ago)0241MITPHPPHP &gt;=5.4.0

Since Jul 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ilyutkin/country)[ Packagist](https://packagist.org/packages/rovereto/country)[ RSS](/packages/rovereto-country/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (1)

Laravel Country
===============

[](#laravel-country)

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

[![Packagist](https://camo.githubusercontent.com/4cc609fcaa54926442b8d6da1bb8c7c179d49a87691a4a4871dd4adaf85aede1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f76657265746f2f636f756e7472792e7376673f6c6162656c3d5061636b6167697374267374796c653d666c61742d737175617265)](https://packagist.org/packages/rovereto/country)[![License](https://camo.githubusercontent.com/9c2fd5b6cc896a7f6733e5a6313fc73e514c43133fba6f40c47b38f25569f650/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f726f76657265746f2f636f756e7472792e7376673f6c6162656c3d4c6963656e7365267374796c653d666c61742d737175617265)](https://github.com/ilyutkin/country/blob/master/LICENSE.md)[![Packagist Downloads](https://camo.githubusercontent.com/65add39ef34df1d33d23c4e5f4789df7d3bc87850bac01c432133867e1210110/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f76657265746f2f636f756e7472793f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rovereto/country)

Installation
------------

[](#installation)

Install the package via composer:

```
composer require rovereto/country
```

Usage
-----

[](#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"
```

2. 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"
```

3. 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
------------

[](#contributing)

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

Versioning
----------

[](#versioning)

We use [Semantic Versioning](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/Ilyutkin/Country/tags).

Changelog
---------

[](#changelog)

Refer to the [Changelog](CHANGELOG.md) for a full history of the project.

Support
-------

[](#support)

The following support channels are available at your fingertips:

- [Help on Email](mailto:alexander@ilyutkin.ru)

Author
------

[](#author)

- **Alexander Ilyutkin** [Ilyutkin](https://github.com/Ilyutkin)

See also the list of [contributors](https://github.com/ilyutkin/country/contributors)who participated in this project.

License
-------

[](#license)

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

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1463d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aa68b35624f6420f10478ae38c27dc89bb34fc4cbc3b195a7caba65f663dd4d0?d=identicon)[rovereto](/maintainers/rovereto)

---

Top Contributors

[![ilyutkin](https://avatars.githubusercontent.com/u/2003829?v=4)](https://github.com/ilyutkin "ilyutkin (4 commits)")

---

Tags

ISO 3166countryiso\_3166\_2ip2locationtimezonecontinentsubdivision

### Embed Badge

![Health badge](/badges/rovereto-country/health.svg)

```
[![Health](https://phpackages.com/badges/rovereto-country/health.svg)](https://phpackages.com/packages/rovereto-country)
```

###  Alternatives

[components/flag-icon-css

A curated collection of all country flags in SVG — plus the CSS for easier integration.

12.2k1.7M23](/packages/components-flag-icon-css)[rinvex/countries

Rinvex Countries is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.

1.7k8.0M62](/packages/rinvex-countries)[league/iso3166

ISO 3166-1 PHP Library

69938.4M141](/packages/league-iso3166)[webpatser/laravel-countries

Modern Laravel Countries package providing ISO 3166-2, ISO 3166-3, currency, capital and more for all countries. Compatible with Laravel 11.x, 12.x, and 13.x.

8602.9M10](/packages/webpatser-laravel-countries)[brick/date-time

Date and time library

3663.8M108](/packages/brick-date-time)[ip2location/ip2location-php

\[Official Release\] IP2Location PHP API to get location info from IPv4 and IPv6 address.

2244.2M37](/packages/ip2location-ip2location-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
