PHPackages                             artisanweblab/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. artisanweblab/spatial

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

artisanweblab/spatial
=====================

PostgreSQL spatial data types extension for Laravel

1.x-dev(2y ago)14753[2 PRs](https://github.com/ArtisanWebLab/spatial/pulls)MITPHPPHP ^8.3|^8.2|^8.1

Since Nov 5Pushed 2y agoCompare

[ Source](https://github.com/ArtisanWebLab/spatial)[ Packagist](https://packagist.org/packages/artisanweblab/spatial)[ Docs](https://github.com/ArtisanWebLab/spatial)[ RSS](/packages/artisanweblab-spatial/feed)WikiDiscussions 1.x Synced 1w ago

READMEChangelogDependencies (6)Versions (4)Used By (0)

Laravel Spatial
===============

[](#laravel-spatial)

```
composer require artisanweblab/spatial
```

PostgreSQL and PostGIS
----------------------

[](#postgresql-and-postgis)

PostGIS is a spatial database extender for PostgreSQL object-relational database. It adds support for geographic objects allowing location queries to be run in SQL.

[PostGIS Official Documentation](https://postgis.net/documentation)

[Install PostGIS to your Web server](https://postgis.net/install/)

[Install PostGIS to your Docker container](https://github.com/postgis/docker-postgis)

MySQL and MariaDB
-----------------

[](#mysql-and-mariadb)

MySQL and MariaDB have built-in support for spatial data.

Integration with your project
-----------------------------

[](#integration-with-your-project)

### Prepare your table

[](#prepare-your-table)

Add fields with the required data type:

Laravel 10 and before:

```
$table->point('point')->isGeometry()->nullable();
```

Laravel 11 and after:

```
$table->geometry('point', 'point')->nullable();
```

### Prepare your model

[](#prepare-your-model)

```
