PHPackages                             fundistadi/postgis-bundle - 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. fundistadi/postgis-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

fundistadi/postgis-bundle
=========================

PostGIS spatial types, automatic GiST indexing, and ST\_\* DQL functions for Doctrine ORM 3 / DBAL 4 on Symfony.

v0.4.0(today)05↑2900%MITPHPPHP &gt;=8.4CI passing

Since Aug 7Pushed todayCompare

[ Source](https://github.com/fundistadi/postgis-bundle)[ Packagist](https://packagist.org/packages/fundistadi/postgis-bundle)[ RSS](/packages/fundistadi-postgis-bundle/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (8)Versions (6)Used By (0)

PostGIS for Symfony!
====================

[](#postgis-for-symfony)

[![CI](https://github.com/fundistadi/postgis-bundle/actions/workflows/ci.yml/badge.svg)](https://github.com/fundistadi/postgis-bundle/actions/workflows/ci.yml)[![Latest Version](https://camo.githubusercontent.com/789b0837768dab16342b3837d61a3cdece58a8f2c8e43503fbc147475f81e1cf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66756e646973746164692f706f73746769732d62756e646c65)](https://packagist.org/packages/fundistadi/postgis-bundle)[![Total Downloads](https://camo.githubusercontent.com/6a898d77c1a87ec94bf31ffe546c47d1206ae185d5ec95e1496827299e8406d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66756e646973746164692f706f73746769732d62756e646c65)](https://packagist.org/packages/fundistadi/postgis-bundle)[![License](https://camo.githubusercontent.com/994ee0d8ae41aab0c84228a4b854398953b43a31febdfc0f6a24bf573e0a26fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f66756e646973746164692f706f73746769732d62756e646c65)](LICENSE)

This bundle gives Doctrine ORM 3 / DBAL 4 first-class **PostGIS** support: spatial column types exchanged as **GeoJSON**, `ST_*` DQL functions, **automatic GiST indexing**, and **typed geometry columns with churn-free migrations** — no hand-written spatial SQL, no configuration. Enable the bundle and go.

> Part of [FundiStadi](https://github.com/fundistadi) — open-source tooling for web, ops &amp; data.

Why
---

[](#why)

Doctrine ships no spatial types, and PostGIS stores every shape as the base `geometry`type — so the usual approaches either hand-write DDL or fight `migrations:diff` churn. This bundle handles all of it: declare a column, get a GiST-indexed, GeoJSON-friendly, optionally shape-constrained column with clean diffs.

Install
-------

[](#install)

Applications using [Symfony Flex](https://symfony.com/doc/current/setup.html):

```
composer require fundistadi/postgis-bundle
```

Applications without Symfony Flex — after requiring the package, enable the bundle:

```
// config/bundles.php
return [
    // ...
    FundiStadi\PostGISBundle\FundiStadiPostGISBundle::class => ['all' => true],
];
```

That one line registers the spatial types, the DB-type mappings, the `ST_*` DQL functions, the `USING gist` platform middleware, the typmod-aware schema manager, and the auto-GiST schema listener. Nothing else to configure.

A taste
-------

[](#a-taste)

```
use Doctrine\ORM\Mapping as ORM;

class Area
{
    // Generic geometry — accepts any shape, SRID 4326, diff-clean.
    #[ORM\Column(type: 'geometry')]
    public ?string $footprint = null;   // GeoJSON string in, GeoJSON string out

    // Typed — PostGIS enforces the shape via the typmod, still diff-clean.
    #[ORM\Column(type: 'multipolygon')]
    public ?string $boundary = null;    // geometry(MultiPolygon,4326)
}
```

```
$em->createQuery(
    'SELECT COUNT(a.id) FROM App\Entity\Area a
     WHERE ST_Intersects(a.boundary, ST_GeomFromGeoJSON(:poly)) = true'
)->setParameter('poly', $geoJsonPolygon)->getSingleScalarResult();
```

Column types: `geometry`, `geography`, `point`, `polygon`, `multipolygon`. DQL functions: `ST_AsGeoJSON`, `ST_GeomFromGeoJSON`, `ST_Intersects`, `ST_Union`, `ST_SimplifyPreserveTopology`, `ST_MakeValid`, `ST_CollectionExtract`, `ST_Multi`, `ST_Area`, and `Geography(g)` (the `::geography` cast, for geodesic measurement: `ST_Area(Geography(t.geom))` = m²) — enough to express dissolve-style aggregation entirely in DQL.

Prefer no DQL at all? Extend the repository base and the St methods just exist:

```
use FundiStadi\PostGISBundle\Repository\SpatialEntityRepository;

final class AreaRepository extends SpatialEntityRepository {}   // that's all

$areas->findStIntersecting($geoJson);        // GiST-backed ST_Intersects
$areas->stAreaKm2(['source' => 'wdpa']);     // geodesic km², findBy-style criteria
```

Every method carries the `St` marker — the bundle's signature, never confusable with a Doctrine core method. The geometry column is discovered from the entity's own metadata; an entity without one is rejected at construction with a teaching message. Every geometry/geography column gets a `USING gist` index in generated migrations, automatically.

Documentation
-------------

[](#documentation)

Read the documentation at [docs/index.md](docs/index.md) — including [generic vs. typed geometry columns](docs/geometry-columns.md) and how typed columns stay `migrations:diff`-clean.

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

[](#requirements)

- PHP **8.4+** · Symfony **7.3+ / 8**
- `doctrine/dbal` **^4**, `doctrine/orm` **^3.5**, `doctrine/doctrine-bundle` **^3**
- PostgreSQL with the **PostGIS** extension

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md). CI enforces the standard (php-cs-fixer, PHPStan max, PHPUnit against real PostGIS, lowest→newest dependency matrix) on every pull request.

Credits
-------

[](#credits)

- [Ezekiel Mjema](https://github.com/eemjema)
- [All Contributors](https://github.com/fundistadi/postgis-bundle/graphs/contributors)

License
-------

[](#license)

MIT License (MIT): see the [LICENSE](LICENSE) file for more details.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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 ~0 days

Total

5

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/59482766?v=4)[Ezekiel Mjema](/maintainers/eemjema)[@eemjema](https://github.com/eemjema)

---

Top Contributors

[![eemjema](https://avatars.githubusercontent.com/u/59482766?v=4)](https://github.com/eemjema "eemjema (26 commits)")

---

Tags

symfonyormdoctrinepostgresqldbalgeometrypostgisgisspatialgeojson

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fundistadi-postgis-bundle/health.svg)

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k18.3M415](/packages/easycorp-easyadmin-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

12017.1k](/packages/rcsofttech-audit-trail-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1617.3k15](/packages/2lenet-crudit-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M225](/packages/sulu-sulu)[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.

4566.0M4](/packages/martin-georgiev-postgresql-for-doctrine)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.9M533](/packages/pimcore-pimcore)

PHPackages © 2026

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