PHPackages                             longitude-one/doctrine-spatial - 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. longitude-one/doctrine-spatial

ActiveLibrary[Database &amp; ORM](/categories/database)

longitude-one/doctrine-spatial
==============================

Doctrine multi-platform support for spatial types and functions, compliant with Doctrine 2.19, 3.1, and dev ones (3.2 and 4.0).

5.0.4(1y ago)911.8M—6.9%27[8 issues](https://github.com/longitude-one/doctrine-spatial/issues)[4 PRs](https://github.com/longitude-one/doctrine-spatial/pulls)1MITPHPPHP ^8.1CI failing

Since Jun 18Pushed 1mo ago8 watchersCompare

[ Source](https://github.com/longitude-one/doctrine-spatial)[ Packagist](https://packagist.org/packages/longitude-one/doctrine-spatial)[ RSS](/packages/longitude-one-doctrine-spatial/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)Dependencies (10)Versions (30)Used By (1)

Doctrine Spatial
================

[](#doctrine-spatial)

Doctrine Spatial is a Doctrine ORM/DBAL extension for working with spatial data in PHP applications.

It provides support for spatial types and functions across multiple database engines, while keeping the integration close to Doctrine’s native entity and query model.

Why use it?
-----------

[](#why-use-it)

- Map geometry and geography data with Doctrine entities.
- Use spatial predicates and functions directly in DQL.
- Support PostgreSQL/PostGIS, MySQL, MariaDB, and SQL Server.
- Keep database-specific behavior explicit and well documented.

Current status
--------------

[](#current-status)

[![Project repository badge for longitude-one/doctrine-spatial](https://camo.githubusercontent.com/744dd3d6678ce3ff69ae4628305072cb070a7e2972926886afde5d4f1c2a5d39/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6f6e6769747564652d2d6f6e652d646f637472696e652d2d7370617469616c2d626c7565)](https://camo.githubusercontent.com/744dd3d6678ce3ff69ae4628305072cb070a7e2972926886afde5d4f1c2a5d39/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6f6e6769747564652d2d6f6e652d646f637472696e652d2d7370617469616c2d626c7565)[![Badge indicating stable release version available](https://camo.githubusercontent.com/65f80c7137f42fd864501a197a5cea3746d2cf873938bcdf5371b824a0837cea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c)](https://camo.githubusercontent.com/65f80c7137f42fd864501a197a5cea3746d2cf873938bcdf5371b824a0837cea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c)[![Badge indicating minimum supported PHP version required](https://camo.githubusercontent.com/23d68e008eb7b81439ce0e30945f0e7d3fbe3476367c0c7236ee57f67ae6f25e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c2e7376673f6d61784167653d33363030)](https://camo.githubusercontent.com/23d68e008eb7b81439ce0e30945f0e7d3fbe3476367c0c7236ee57f67ae6f25e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c2e7376673f6d61784167653d33363030)[![Badge showing project license on Packagist](https://camo.githubusercontent.com/1561d389c817c5a2739ec943caf6396e05253acf530c2ed8b6596d09e5872352/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c)](https://github.com/longitude-one/doctrine-spatial/blob/main/LICENSE)

[![Badge showing GitHub Actions full test workflow status](https://camo.githubusercontent.com/65900578c255b813cacca06583cace311e611ddbdc1e914c0d8e3cc07af99b0e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c2f2e676974687562253246776f726b666c6f777325324666756c6c2e79616d6c3f6c6162656c3d46756c6c25323074657374)](https://camo.githubusercontent.com/65900578c255b813cacca06583cace311e611ddbdc1e914c0d8e3cc07af99b0e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c2f2e676974687562253246776f726b666c6f777325324666756c6c2e79616d6c3f6c6162656c3d46756c6c25323074657374)[![Badge showing code coverage status from Codecov](https://camo.githubusercontent.com/90fefbad40c30de733ed992b4aae13be6cfdd61106d7686776852a5f22e36e5e/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c)](https://camo.githubusercontent.com/90fefbad40c30de733ed992b4aae13be6cfdd61106d7686776852a5f22e36e5e/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c)[![Badge showing documentation build status on ReadTheDocs](https://camo.githubusercontent.com/be723c2ce7178236a493a08dfcb95bd7d723a75aab2bb98ebf4666eb847102b9/68747470733a2f2f72656164746865646f63732e6f72672f70726f6a656374732f6c6f2d646f637472696e652d7370617469616c2f62616467652f3f76657273696f6e3d6d61696e)](https://lo-doctrine-spatial.readthedocs.io/en/main/?badge=main)

[![Badge showing last month package downloads on Packagist](https://camo.githubusercontent.com/ad769e018859bde6de60552b9e047df77d0938ed791f46117a4581d56aab9edb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c2e737667)](https://packagist.org/packages/longitude-one/doctrine-spatial)[![Badge showing project star count on Packagist](https://camo.githubusercontent.com/5f52add841182a1a7237e2c76ff9505c9f2bb229b895aea6a2dff41e14bb8fa9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c)](https://camo.githubusercontent.com/5f52add841182a1a7237e2c76ff9505c9f2bb229b895aea6a2dff41e14bb8fa9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c)

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

[](#documentation)

The [documentation](https://doctrine-spatial.readthedocs.io) covers installation, configuration, entity mapping, spatial queries, and contribution guidelines.

It also includes a glossary for the main spatial types and functions supported by the library.

Compatibility
-------------

[](#compatibility)

### PHP and Doctrine ORM

[](#php-and-doctrine-orm)

doctrine-spatialPHPDoctrine ORM.Status**5.0**8.1+`^2.9`, `^3.1`Stable (security fixes).**5.1**8.2+`^2.19`, `^3.1`Next version (development)**5.2**8.3+`^2.19`, `^3.1`Slated for Jan 1, 2027.**6.0**8.5+`^3.6`, `^4.x-dev`In development.Security fixes follow the [PHP support roadmap](https://www.php.net/supported-versions.php).

### Database compatibility

[](#database-compatibility)

The versions below reflect the database stack used for the test matrix.

doctrine-spatialMySQL.MariaDBPostgreSQLPostGISSQL ServerStatus**5.0**5.7, 8.010.6183.6❌Stable (security fixes).**5.1**8.410.11183.62017Next version (development)**5.2**8.410.11183.62017Next version (development)**6.0**8.410.11183.62017in development.Known limitations
-----------------

[](#known-limitations)

`longitude-one/doctrine-spatial` cannot currently store the SRID on MySQL or SQL Server. Internally, the extension uses Well-Known Text (WKT) to bridge database values, but this does not allow both WKT and SRID to be passed together through Doctrine’s persistence model. Extended Well-Known Text (EWKT) solves this for PostGIS, but it is not supported by other database engines.

This limitation can be worked around in practice by using the spatial functions `ST_SetSRID` and `ST_SRID` when needed, so the SRID can still be handled at the query level even if it is not persisted directly with the value.

Project origins
---------------

[](#project-origins)

This library was originally created by Derek J. Lambert. Alexandre Tranchant later forked it from [creof/doctrine-spatial](https://github.com/creof/doctrine2-spatial) after the original project appeared to be inactive since 2017.

Branch strategy
---------------

[](#branch-strategy)

The repository follows a structured release model:

- **main** — Stable 5.0 releases with bug fixes and security updates.
- **5.1.x-dev** — Controlled deprecations to ease the transition toward 6.0.
- **5.2.x-dev** — This branch will drop compatibility with PHP 8.2 and the dedicated code path for it.
- **6.0.x-dev** — Major changes and new features, potentially including breaking changes.

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

[](#contributing)

Contributions, bug reports, and documentation improvements are welcome. Please refer to the documentation for the development workflow and test commands.

###  Health Score

60

—

FairBetter than 98% of packages

Maintenance72

Regular maintenance activity

Popularity57

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 89% 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 ~78 days

Recently: every ~103 days

Total

20

Last Release

397d ago

Major Versions

3.0.2 → 4.0.0-rc12023-05-11

4.0.0-rc2 → 5.0.0.RC2024-03-11

PHP version history (2 changes)3.0.0-RC1PHP ^7.4|^8.0

4.0.0-rc1PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5101481?v=4)[Alexandre Tranchant](/maintainers/Alexandre-T)[@Alexandre-T](https://github.com/Alexandre-T)

---

Top Contributors

[![Alexandre-T](https://avatars.githubusercontent.com/u/5101481?v=4)](https://github.com/Alexandre-T "Alexandre-T (146 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![toooni](https://avatars.githubusercontent.com/u/241080?v=4)](https://github.com/toooni "toooni (2 commits)")[![shakaran](https://avatars.githubusercontent.com/u/14254?v=4)](https://github.com/shakaran "shakaran (2 commits)")[![holtkamp](https://avatars.githubusercontent.com/u/776405?v=4)](https://github.com/holtkamp "holtkamp (1 commits)")[![lacatoire](https://avatars.githubusercontent.com/u/20201470?v=4)](https://github.com/lacatoire "lacatoire (1 commits)")[![PowerKiKi](https://avatars.githubusercontent.com/u/72603?v=4)](https://github.com/PowerKiKi "PowerKiKi (1 commits)")[![axi](https://avatars.githubusercontent.com/u/389340?v=4)](https://github.com/axi "axi (1 commits)")[![cinamo](https://avatars.githubusercontent.com/u/7139230?v=4)](https://github.com/cinamo "cinamo (1 commits)")

---

Tags

doctrineextensionpostgisspatial-datadatabaseormmysqlpostgresqlmariadbdbalgeometrygeographyopengispostgisgisspatialiso-13249

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/longitude-one-doctrine-spatial/health.svg)

```
[![Health](https://phpackages.com/badges/longitude-one-doctrine-spatial/health.svg)](https://phpackages.com/packages/longitude-one-doctrine-spatial)
```

###  Alternatives

[creof/doctrine2-spatial

Doctrine2 multi-platform support for spatial types and functions

2733.4M12](/packages/creof-doctrine2-spatial)[jsor/doctrine-postgis

Spatial and Geographic Data with PostGIS and Doctrine.

2211.8M1](/packages/jsor-doctrine-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.

4566.0M4](/packages/martin-georgiev-postgresql-for-doctrine)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58926.6M60](/packages/scienta-doctrine-json-functions)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

856.1k](/packages/tommyknocker-pdo-database-class)

PHPackages © 2026

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