PHPackages                             smart/geo - 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. [Database &amp; ORM](/categories/database)
4. /
5. smart/geo

ActiveLibrary[Database &amp; ORM](/categories/database)

smart/geo
=========

Smart Geo is databases from Open Data providers compiled into easy to use PHP objects.

0.4.0(9y ago)0323MITPHPPHP &gt;=5.6.0

Since Nov 19Pushed 9y ago2 watchersCompare

[ Source](https://github.com/smart-io/geo)[ Packagist](https://packagist.org/packages/smart/geo)[ Docs](https://github.com/smart-io/geo)[ RSS](/packages/smart-geo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (18)Used By (0)

This library is deprecated, use [geobase/countries](https://github.com/geobase/php-countries) instead.
======================================================================================================

[](#this-library-is-deprecated-use-geobasecountries-instead)

Smart Geo
=========

[](#smart-geo)

[![Build Status](https://camo.githubusercontent.com/b4c74626de03f1bc62a3955d1380e65170f06822b39a24954e2adfaafb7a69ba/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f736d6172742d696f2f67656f2f6d61737465722e7376673f7374796c653d666c6174)](https://travis-ci.org/smart-io/geo)[![Latest Stable Version](https://camo.githubusercontent.com/ee03d4a4e23bb8a42a22db3e21763deb3d15aad13ccfe19eac912650980efef6/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736d6172742f67656f2e7376673f7374796c653d666c6174)](https://packagist.org/packages/smart/geo)[![Total Downloads](https://camo.githubusercontent.com/d942992b0fa12cf498c4884e094f7ce595774d513db1d2c9c30359ad652fa9ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736d6172742f67656f2e7376673f7374796c653d666c6174)](https://packagist.org/packages/smart/geo)[![License](https://camo.githubusercontent.com/036b487a35c43504fb57aaed88a1fde2835c989613acf0d55009fb2165817c6e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736d6172742f67656f2e7376673f7374796c653d666c6174)](https://packagist.org/packages/smart/geo)

Smart Geo is databases from Open Data providers compiled into easy to use PHP objects.

1. [Features](#features)
2. [Sources](#sources)
3. [Requirements](#requirements)
4. [Installation](#installation)
5. [Country](#country)
6. [Region](#region)

Features
--------

[](#features)

- Multiple languages (Currently only supports English, French and German).
- Country Database
- Region Database (Currently only for Canada and the United States).
- IP Geolocation (With MaxMind)

Sources
-------

[](#sources)

- [GeoNames](http://www.geonames.org/)
- [Wikipedia](http://en.wikipedia.org/)
- [OpenStreetMap](http://www.openstreetmap.org/)

Requirements
------------

[](#requirements)

Smart Geo does not require a database, but instead, uses JSON files.

This library uses PHP 5.6+.

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

[](#installation)

You need to install the Smart Geo library through composer. To do so, add the following lines to your composer.json file.

```
{
    "require": {
       "smart/geo": "dev-master"
    }
}
```

To download or update the current data, use the following command.

```
php vendor/bin/geo data:update
```

Country
-------

[](#country)

Database of all countries in the world.

**Properties**

- Names
- Short Code (Alpha-2 code)
- Code (Alpha-3 code)
- Latitude
- Longitude
- Bounding Box
- Currency
- Continent
- Population
- Area
- Capital
- Timezone

**Examples**

Get a list of all countries.

```
$countryCollection = (new Geo)->getCountryRepository()->findAll();
```

Get country name in english.

```
foreach ($countryCollection as $country) {
   echo $country->getNames()->get('en');
}
```

Order by country name in english.

```
$countryCollection->orderByName();
```

Region
------

[](#region)

Database of all States, Federal Districts and Territories in the United States, Provinces and Territories in Canada.

**Properties**

- Name
- Code (Alpha-2 code)
- Country
- Type
- Latitude
- Longitude
- Bounding Box

**Examples**

Get a list of all regions in the US.

```
$geo = new Geo;
$country = $geo->getCountryRepository()->findByCode('US');
$regionCollection = (new Geo)->getRegionRepository()->findByCountry($country);
```

Get region name and type in english.

```
foreach ($regionCollection as $region) {
   echo $region->getNames()->get('en') . " is a " .
       $region->getType()::class . " of the " .
       $country->getNames()->get('en);
}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

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

Every ~42 days

Recently: every ~81 days

Total

17

Last Release

3522d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

geoipdatadatabasegeolocationstatecountryregionprovince

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/smart-geo/health.svg)

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

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[doctrine/migrations

PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is a very easy to use and a powerful tool.

4.8k204.8M440](/packages/doctrine-migrations)[maxmind-db/reader

MaxMind DB Reader API

69799.2M47](/packages/maxmind-db-reader)[robmorgan/phinx

Phinx makes it ridiculously easy to manage the database migrations for your PHP app.

4.5k46.2M405](/packages/robmorgan-phinx)[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[annexare/countries-list

Continents &amp; countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

1.3k220.8k1](/packages/annexare-countries-list)

PHPackages © 2026

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