PHPackages                             perspectivain/yii2-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. perspectivain/yii2-geo

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

perspectivain/yii2-geo
======================

An interface to generate geographic annotations in different formats

24821PHP

Since Feb 16Pushed 11y ago3 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 Geo
========

[](#yii2-geo)

An interface to generate geographic annotations in different formats.

Currently supports KML and geoJSON formats and MultiPolygon, Point and Polygon types.

```
More about geoJSON: http://geojson.org/geojson-spec.html

More about KML: https://developers.google.com/kml/documentation/

```

Usage
=====

[](#usage)

Create and action to response in geo format

```
use perspectivain\geo\kml\Kml;
use perspectivain\geo\kml\models\Polygon;
use perspectivain\geo\kml\models\Point;

public function actionCityDistricts()
{
  $document = new Kml; //change to "new Geojson" to generate this file
  $document->id = 'district';

  $districts = District::find()->all();
  foreach($districts as $district) {

      $polygon = new Polygon;

      foreach($district->coordinates as $coordinate) {
          $point = new Point;
          $point->value = $coordinate;
          $polygon->value[] = $point;
          unset($point);
      }

      $document->add($polygon);
      unset($polygon);
  }

  return $document->output();
}

```

And the return is an valid KML file

Passing properties in object
============================

[](#passing-properties-in-object)

To pass properties to object, do this:

```
$polygon = new Polygon;
$polygon->extendedData = [
  'property' => 1,
];

```

Installing
==========

[](#installing)

The preferred way to install this extension is through composer.

```
{
  "require": {
    "perspectivain/yii2-geo": "*"
  }
}

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/91f1601b0d5df44b7f4008beed1206c8fde96a7cd31145270a53268d57ef09c0?d=identicon)[jsopra](/maintainers/jsopra)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[friendsoftypo3/extension-builder

Tool to kickstart and maintain TYPO3 extensions

114805.9k5](/packages/friendsoftypo3-extension-builder)[rossriley/phrocco

Literate documentation for PHP

963.0k](/packages/rossriley-phrocco)[erickskrauch/phpstan-yii2

Yii2 extension for PHPStan

1269.5k1](/packages/erickskrauch-phpstan-yii2)

PHPackages © 2026

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