A Laravel package for working with MySQL Spatial Data Types and Spatial Functions in Eloquent models and migrations.
Laravel MySQL Spatial is a Laravel package that integrates MySQL's spatial data extensions into the Laravel ecosystem. It allows developers to use MySQL spatial data types (like points, polygons, and linestrings) and spatial functions directly within Eloquent models and database migrations. This solves the problem of handling geographic data in Laravel applications without relying on external GIS systems.
Laravel developers building applications that require geographic data storage and queries, such as location-based services, mapping tools, or geospatial analytics.
Developers choose this package because it seamlessly integrates MySQL's spatial capabilities into Laravel's Eloquent ORM and migration system, offering a familiar API for complex geospatial operations. It eliminates the need for raw SQL queries and provides type-safe geometry classes with support for modern standards like GeoJSON.
MySQL Spatial Data Extension integration with Laravel.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Seamlessly adds spatial data handling to Laravel models using traits and scopes, making it feel native as described in the philosophy section.
Provides PHP classes for all MySQL spatial types with helpers for WKT, GeoJSON, and array operations, simplifying data manipulation and serialization.
Includes built-in Eloquent scopes for common spatial analyses like distance, within, and intersects, reducing the need for raw SQL queries.
Offers easy-to-use migration methods for creating spatial columns and indexes, facilitating database schema management without manual SQL.
The package is tightly coupled to MySQL, preventing the use of more powerful spatial databases like PostGIS and limiting future scalability or database switches.
With separate branches for different MySQL and Laravel versions, as noted in the README, it adds maintenance overhead and risk of compatibility issues.
Setting up spatial indexes requires handling table engine constraints and nullable fields, which can be error-prone and complex, especially for older MySQL versions.