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

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

yii2-extensions/postgis
=======================

Yii2-extension to work with postgis data

1.0.0(1y ago)016BSD-3-ClausePHP

Since Oct 10Pushed 1y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)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": {
    "yii2-extensions/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')"`CREDITS
-------

[](#credits)

This extension was forked and lives here to keep going great work in keeping with Yii2 community open source spirit. Find Original code at

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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

576d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c021a0fa6c1e35d69de6a6027e607b9f14efe6844c9072246d7f795c29809d3?d=identicon)[Stefano Mtangoo](/maintainers/Stefano%20Mtangoo)

---

Tags

postgresqlpostgresyii2extensionBehavioryiipostgisspatialpostgre

### Embed Badge

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

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

###  Alternatives

[nanson/yii2-postgis

Yii2-extension to work with postgis data

1851.6k](/packages/nanson-yii2-postgis)[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)
