PHPackages                             lysak/yii2-sypexgeo - 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. lysak/yii2-sypexgeo

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

lysak/yii2-sypexgeo
===================

Yii2 extension for Sypex Geo API (http://sypexgeo.net)

v1.0.2(5y ago)00BSD-3-ClausePHPPHP &gt;=7.2

Since Dec 2Pushed 5y agoCompare

[ Source](https://github.com/Lysak/yii2-sypexgeo)[ Packagist](https://packagist.org/packages/lysak/yii2-sypexgeo)[ Docs](https://github.com/koftikes/yii2-sypexgeo)[ RSS](/packages/lysak-yii2-sypexgeo/feed)WikiDiscussions master Synced 3d ago

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

Yii2 extension for Sypex Geo API ()
========================================================

[](#yii2-extension-for-sypex-geo-api-httpsypexgeonet)

This extension adds support for Sypex Geo to the Yii2 framework

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist lysak/yii2-sypexgeo "*"

```

or add

```
"lysak/yii2-sypexgeo": "^1.0"
```

to the `require` section of your composer.json.

What it is all about?
---------------------

[](#what-it-is-all-about)

Sypex Geo - product for location by IP address. Obtaining the IP address, Sypex Geo outputs information about the location of the visitor - country, region, city, geographical coordinates and other in Russian and in English. Sypex Geo use local compact binary database file and works very quickly. For more information visit:

This is extension for Yii2 framework that makes it easy to deal with Sypex Geo.

Usage
-----

[](#usage)

Unfortunately, original version of Sypex Geo does not support Composer installation, so we have to include it into this extension.

First of all, you have to download desired database from the  website and place it somewhere on your server.

There are two classes in this extension.

**SypexGeo** - this is the component can be used to retrieve Geo information based on IP address. Component encapsulates calls to the SxGeo methods.

You can use it as an application component:

```
// config.php
[
    'components' => [
        'sypexGeo' => [
            'class' => 'lysak\components\SypexGeo',
            'database' => '@app/data/SxGeoCity.dat',
        ]
    ]
]

// somewhere in your code
$city = Yii::$app->sypexGeo->getCity($ip);
```

Also, you can create an instance by yourself:

```
use lysak\components\SypexGeo;
// ...
$sypexGeo = new SypexGeo([
    'database' => '@app/data/SxGeoCity.dat',
]);
$city = $sypexGeo->getCity($ip);
```

**GeoBehavior** - behavior that can be attached to the `yii\web\Request` or it's children and this class adds methods to simplify getting Geo information for current request.

Example:

```
// config.php
[
    'components' => [
        'request' => [
            'as sypexGeo' => [
                'class' => 'lysak\behaviors\GeoBehavior',
                // It is not required property if you have SypexGeo component defined in your application
                'config' => [
                    'database' => '@app/data/SxGeoCity.dat',
                ]
            ]
        ]
    ],
]

// In your code
$city = Yii::$app->request->getCity();
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~2228 days

Total

2

Last Release

1952d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.4.0

v1.0.2PHP &gt;=7.2

### Community

Maintainers

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

---

Top Contributors

[![omnilight](https://avatars.githubusercontent.com/u/3306537?v=4)](https://github.com/omnilight "omnilight (6 commits)")[![koftikes](https://avatars.githubusercontent.com/u/8553840?v=4)](https://github.com/koftikes "koftikes (1 commits)")[![Lysak](https://avatars.githubusercontent.com/u/4108154?v=4)](https://github.com/Lysak "Lysak (1 commits)")

---

Tags

yii2extensionmodulegeosypexgeo

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lysak-yii2-sypexgeo/health.svg)

```
[![Health](https://phpackages.com/badges/lysak-yii2-sypexgeo/health.svg)](https://phpackages.com/packages/lysak-yii2-sypexgeo)
```

###  Alternatives

[kartik-v/yii2-ipinfo

An IP address information display widget for Yii 2.0 with country flag and geo position info.

2832.6k1](/packages/kartik-v-yii2-ipinfo)[omnilight/yii2-sypexgeo

Yii2 extension for Sypex Geo API (http://sypexgeo.net)

17102.0k](/packages/omnilight-yii2-sypexgeo)[onmotion/yii2-telegram

Support chat for site based on Telegram bot

526.3k](/packages/onmotion-yii2-telegram)

PHPackages © 2026

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