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(10mo ago)891.4M—0.2%28[9 issues](https://github.com/longitude-one/doctrine-spatial/issues)[10 PRs](https://github.com/longitude-one/doctrine-spatial/pulls)1MITPHPPHP ^8.1CI failing

Since Jun 18Pushed 3mo 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 1mo ago

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

doctrine-Spatial
================

[](#doctrine-spatial)

Doctrine-spatial is a doctrine extension. It implements spatial types and functions. *As exemple, this extension can help you to know if your favorite superheroes is inside Gotham city.*

Currently, MySQL and PostgreSQL with PostGIS are supported. Could potentially add support for other platforms if an interest is expressed.

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

[](#current-status)

[![longitude-one/doctrine--spatial](https://camo.githubusercontent.com/744dd3d6678ce3ff69ae4628305072cb070a7e2972926886afde5d4f1c2a5d39/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6f6e6769747564652d2d6f6e652d646f637472696e652d2d7370617469616c2d626c7565)](https://camo.githubusercontent.com/744dd3d6678ce3ff69ae4628305072cb070a7e2972926886afde5d4f1c2a5d39/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6f6e6769747564652d2d6f6e652d646f637472696e652d2d7370617469616c2d626c7565)[![Stable release](https://camo.githubusercontent.com/65f80c7137f42fd864501a197a5cea3746d2cf873938bcdf5371b824a0837cea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c)](https://camo.githubusercontent.com/65f80c7137f42fd864501a197a5cea3746d2cf873938bcdf5371b824a0837cea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c)[![Minimum PHP Version](https://camo.githubusercontent.com/16778a9ba978c2df3d1c27e75175962fef7b5d23606d1d9680e36cf9b52eac3c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6f6e6769747564652d6f6e652f776b742d7061727365722e7376673f6d61784167653d33363030)](https://camo.githubusercontent.com/16778a9ba978c2df3d1c27e75175962fef7b5d23606d1d9680e36cf9b52eac3c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6f6e6769747564652d6f6e652f776b742d7061727365722e7376673f6d61784167653d33363030)[![Packagist License](https://camo.githubusercontent.com/1561d389c817c5a2739ec943caf6396e05253acf530c2ed8b6596d09e5872352/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c)](https://github.com/longitude-one/doctrine-spatial/blob/main/LICENSE)

[![Last integration test](https://github.com/longitude-one/doctrine-spatial/actions/workflows/full.yaml/badge.svg)](https://github.com/longitude-one/doctrine-spatial/actions/workflows/full.yaml)[![Maintainability](https://camo.githubusercontent.com/32b965a9064a43fe21c7071536dceb61897ce44737f4d88b5194a1d28a50aaba/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f39326232343561383561623466626163613564322f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/longitude-one/doctrine-spatial/maintainability)[![Downloads](https://camo.githubusercontent.com/ad769e018859bde6de60552b9e047df77d0938ed791f46117a4581d56aab9edb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6c6f6e6769747564652d6f6e652f646f637472696e652d7370617469616c2e737667)](https://packagist.org/packages/longitude-one/doctrine-spatial)[![Test Coverage](https://camo.githubusercontent.com/5dceccfd46d552893299cb8215cf89d243fc6acbb81ca4381c01654e2aae438b/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f39326232343561383561623466626163613564322f746573745f636f766572616765)](https://codeclimate.com/github/longitude-one/doctrine-spatial/test_coverage)[![Documentation Status](https://camo.githubusercontent.com/be723c2ce7178236a493a08dfcb95bd7d723a75aab2bb98ebf4666eb847102b9/68747470733a2f2f72656164746865646f63732e6f72672f70726f6a656374732f6c6f2d646f637472696e652d7370617469616c2f62616467652f3f76657273696f6e3d6d61696e)](https://lo-doctrine-spatial.readthedocs.io/en/main/?badge=main)

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

[](#documentation)

The [documentation](https://doctrine-spatial.readthedocs.io) explain how to:

- install this doctrine extension,
- configure this extension,
- create spatial entities,
- use spatial functions in your repositories,
- contribute (and test)

The documentation contains a glossary of all available types and all available spatial functions.

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

[](#project-origins)

This useful library was created by Derek J. Lambert. Alexandre Tranchant forked it from [creof/doctrine-spatial](https://github.com/creof/doctrine2-spatial)because project seems to be non-active since 2017.

The longitude-one/doctrine-spatial repository employs a well-structured branching strategy:

- main: Stable 5.0 releases, bug fixes and minor new features (no backward incompatibilities).
- 6.0.x-dev: Major new features (**potential** backward incompatibilities).
- 5.1.x-dev: Controlled deprecations for a smooth 5.1 to 6.0 transition (no backward incompatibilities).

This approach ensures clarity, stability, and maintainability for the project.

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

[](#compatibility)

### PHP and Doctrine ORM

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

This Doctrine extension is compatible with PHP 8.1+ and Doctrine ORM versions `^2.9`, `^3.1`, and aims for continued compatibility with the upcoming major version `^4.x-dev`. Security fixes will follow the [PHP Roadmap](https://www.php.net/supported-versions.php).

### MySQL 5.7 and 8.0

[](#mysql-57-and-80)

MySQL5.7 is supported, but is deprecated. MySQL8.0 is supported.

Known Limitation: `longitude-one/doctrine-spatial` CANNOT store SRID on MySQL. Internally, this extension uses Well Known Text to convert internal types to database type. As `doctrine/orm` does not allow custom persister nor collection persister, we cannot provide two parameters (WKT and SRID). Extented Well Known Text (EWKT) is used to convert internal types to databases but EWKT is only supported by Postgis. I'm trying a new solution: create an external Well Known Bytes converter to be able to use it `convertToDatabaseValue` methods of `doctrine/orm` and `longitude-one/doctrine-spatial`.

### PostgreSQL

[](#postgresql)

This spatial library is compatible with PostgreSql. This library is tested with the last versions of Postgis and PostgreSql.

### MariaDB

[](#mariadb)

This spatial library is compatible with MariaDB 10.6.

Help wanted
-----------

[](#help-wanted)

**Microsoft SQL Server**I'm searching help to create a docker delivering a Microsoft SQL Server service. So I'll be able to implement compatibility with this database server.

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance66

Regular maintenance activity

Popularity56

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 89.4% 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

305d 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 (135 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)")[![cinamo](https://avatars.githubusercontent.com/u/7139230?v=4)](https://github.com/cinamo "cinamo (1 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)")

---

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

2763.3M11](/packages/creof-doctrine2-spatial)[jsor/doctrine-postgis

Spatial and Geographic Data with PostGIS and Doctrine.

2191.6M1](/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.

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

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

58723.9M36](/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.

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

PHPackages © 2026

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