clickbar/laravel-magellan
Laravel Magellan is a modern PostGIS toolbox for Laravel. It provides geometry data classes, generators and parsers, request validation, and seamless database interaction for inserting, updating, and querying spatial data with PostGIS functions.
Architecture fit. Magellan is a thin, opinionated layer over PostGIS that plugs into Eloquent and Laravel's schema builder. It is a strong fit only if the target product genuinely needs spatial data: proximity/radius search, geofencing, polygon containment, route/heatmap aggregation, or store-locator style queries. In that case it removes a meaningful amount of SQL boilerplate (geometry casts, Blueprint column macros, GeoJSON/WKB parsing, request validation and SRID transformation) without introducing a new service into the architecture. It is a poor fit if the stack is MySQL, if geo functionality is a single "distance between two points" feature better served by a haversine index, or if the organization already standardizes geo workloads on a dedicated service (Elasticsearch geo, PostGIS behind an API, a maps vendor). It is an ORM-adjacent library, not a data platform — it does not provide tiling, routing, or geocoding.
Integration feasibility. Composer install, extension enablement, config publish, then additive migrations and Eloquent casts. The work is bounded (days for a scoped pilot), but the real cost is competence, not integration: SRID conventions, geometry vs geography selection, and GiST index design are decisions the package exposes rather than makes for you. A 1.x→2.x upgrade path exists, which is a positive signal of API discipline but also evidence of breaking-change churn.
Technical risk.
Key questions.
ST_DWithin predicates alone?Stack fit. Laravel + PostgreSQL with the PostGIS extension. Compatible with managed Postgres (RDS, Cloud SQL, Supabase, Neon) provided the extension can be enabled — verify this before committing, since some managed tiers restrict it. Incompatible with SQLite/MySQL test environments, which is the single most common integration surprise.
Migration path (additive and reversible).
CONCURRENTLY to avoid table locks on large tables.Compatibility. Confirm the supported Laravel/PHP matrix against our current and next major framework version before adoption; a package pinned to the previous Laravel major is a near-term upgrade tax. Verify PostGIS 3.x and Postgres 13+. If any 1.x code exists in the codebase, scope the 2.x breaking changes explicitly.
Sequencing.
Maintenance. Small surface area and MIT licensing keep maintenance cheap in steady state. The recurring costs are: tracking releases and scheduling major-version upgrades, keeping PostGIS aligned across environments, and periodically re-validating query plans as data grows. Pin to a minor version and upgrade deliberately rather than floating.
Support. Community-only — GitHub issues, no SLA, no commercial backing. This is acceptable for an internal or non-critical feature; it is not acceptable for a revenue-critical or availability-critical geo capability without an internal owner who can read the generated SQL and fall back to hand-written PostGIS. Establish that owner before adoption, not after.
Scaling. PostGIS scales well when indexes are right and badly when they are not. The predictable pressure points: unbounded ST_Distance ordering across large tables (use ST_DWithin with an index-friendly bounding predicate, then sort within the candidate set); high-cardinality geography distance calculations, which are correct-by-default but costlier than projected geometry; geometry payloads inflating API responses and memory when casting large result sets; and connection-pool exhaustion under geo-heavy read traffic. Read replicas help read-mostly workloads; write-heavy ingestion needs batching and index-write cost budgeting.
Failure modes.
geometry chosen where geography was needed (or vice versa) → either incorrect results at high latitudes or a silent performance cliff.Ramp-up. A competent Laravel developer can install the package and ship a simple radius query in one to two days. Real proficiency — SRIDs, spatial predicates, GiST index strategy, geometry vs geography tradeoffs — takes one to two weeks of deliberate practice and should include a review by someone with prior PostGIS experience. Budget for internal documentation in the first sprint; the package's own README is good but does not substitute for team-specific conventions.
How can I help you explore Laravel packages today?