PHPackages                             nanson/yii2-postgis - 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. nanson/yii2-postgis

ActiveYii2-extension[Database &amp; ORM](/categories/database)

nanson/yii2-postgis
===================

Yii2-extension to work with postgis data

1.0.1(9y ago)1851.6k↓39%7[1 issues](https://github.com/nanson/yii2-postgis/issues)BSD-3-ClausePHP

Since Jul 16Pushed 5y ago4 watchersCompare

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

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

Yii2 Postgis
============

[](#yii2-postgis)

Extension for working with [Postgis](http://postgis.net/). As intermediate format used Geo Json.

Installing
----------

[](#installing)

The preferred way to install this extension is through Composer.

```
{
  "require": {
    "nanson/yii2-postgis": "*"
  }
}
```

GeometryBehavior
----------------

[](#geometrybehavior)

Converts coordinates array to SQL expression for saving in postgis binary format before insert/update and from postgis binary to array after find.

```

```

OptionTypeDefaultDescriptionattributestringattribute that will be automatically handledtypestringgeometry type: `Point`, `LineString`, `Polygon`, `MultiPoint`, `MultiLineString`, `MultiPolygon`skipAfterFindPostgisbooleanfalseskip convertion after find, if data in postgis binary (it requires a separate query, look `PostgisQueryTrait`)StBufferBehavior
----------------

[](#stbufferbehavior)

Generate SQL expression before insert/update based on geometry and radius

```

```

OptionTypeDefaultDescriptionattributestringattribute for saving bufferattributeGeometrystringattribute with geometryattributeRadiusstringattribute with radiusgeographybooleanfalsebuild buffer as geographyradiusUnitstring`deg` for geomtery or `m` for geographyunits of buffer radius: `deg`, `m`, `km`optionsarray\[\]additional options for St\_Buffer functionPostgisQueryTrait
-----------------

[](#postgisquerytrait)

Extends ActiveQuery for working with Postgis data.

```

```

OptionTypeDefaultDescriptionautoGeoJsonbooleantrueselect all geo columns as GeoJson automaticallygeoFieldsarrayall table columns with data type `geometry` or `geography`table columns, that must be selected as Geo JsonexceptGeoFieldsbooleanfalseexclude all geo columns from select statementexceptFieldsarray\[\]columns, which must be excluded from select statementMethodDescriptionwithGeoFields($fields=null)Add columns, that must be selected as Geo Json. Accepts `null`, `string`, `array`. If `fields` is null - all `geoFileds` will be added.excludeFields($fields=null)Exclude columns from select statement. Accepts `null`, `string`, `array`. If `fields` is null - all `exceptFields` will be excluded from select statement.GeoJsonHelper
-------------

[](#geojsonhelper)

Helper for working with Geo Json

MethodReturnsDescriptiontoArray($geoJson)arrayreturns coordinates array by Geo JsontoGeoJson($type, $coordinates, $srid=4326)string (geo json)returns Geo Json by geometry type, coordinates array and SRIDtoGeometry($type, $coordinates, $srid=4326)string (sql expression)the same, that `toGeoJson`, but wraps result by `"ST_GeomFromGeoJSON('$geoJson')"`

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 74.2% 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 ~214 days

Total

2

Last Release

3379d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e89a929b5f4199f13d5198bfc9cf1ea0284462e078c6efd9a12b075ac215219?d=identicon)[nanson](/maintainers/nanson)

---

Top Contributors

[![thedenische](https://avatars.githubusercontent.com/u/5646566?v=4)](https://github.com/thedenische "thedenische (23 commits)")[![esp4ik](https://avatars.githubusercontent.com/u/6011909?v=4)](https://github.com/esp4ik "esp4ik (3 commits)")[![rvkulikov](https://avatars.githubusercontent.com/u/21280882?v=4)](https://github.com/rvkulikov "rvkulikov (3 commits)")[![bwragg](https://avatars.githubusercontent.com/u/4515907?v=4)](https://github.com/bwragg "bwragg (1 commits)")[![oddssoft](https://avatars.githubusercontent.com/u/26416154?v=4)](https://github.com/oddssoft "oddssoft (1 commits)")

---

Tags

postgresqlpostgresyii2extensionBehavioryiipostgisspatialpostgre

### Embed Badge

![Health badge](/badges/nanson-yii2-postgis/health.svg)

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

###  Alternatives

[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4485.3M4](/packages/martin-georgiev-postgresql-for-doctrine)[sjaakp/yii2-sortable-behavior

Sort ActiveRecords and related records in Yii2.

36144.7k](/packages/sjaakp-yii2-sortable-behavior)[tigrov/yii2-pgsql

Improved PostgreSQL schemas for Yii2

3467.0k](/packages/tigrov-yii2-pgsql)[sjaakp/yii2-spatial

Yii2 ActiveRecord supporting MySQL spatial data

1873.8k1](/packages/sjaakp-yii2-spatial)[mg-code/yii2-helpers

A collection of useful helper classes for Yii framework 2.0

2022.5k5](/packages/mg-code-yii2-helpers)

PHPackages © 2026

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