salmanzafar/laravel-geo-fence
A Laravel package for geo-fencing: define geographic boundaries and test whether coordinates or models fall inside them. Useful for location-based access rules, delivery zones, and region restrictions, with a simple, framework-friendly API.
Architecture fit. The package follows the conventional Laravel package shape: a Composer-installable library with a service provider (and likely a facade) wrapping a small domain utility. On paper this fits any Laravel application that needs latitude/longitude distance computation. In practice, the architecture is a thin veneer over a textbook Haversine (or similar great-circle) formula — roughly 20–40 lines of pure PHP math. There is no persistence layer, no queueing, no eventing, and no configuration surface beyond possibly an earth-radius or unit constant. That means it integrates cleanly but contributes very little architectural leverage.
Integration feasibility. High. Adoption is a single composer require, and Laravel package auto-discovery likely registers the provider without manual wiring. There is no schema change, no migration, no external service dependency, and no credentials to manage. A developer can be productive within an hour.
Technical risk. The risk is not integration risk; it is provenance and longevity risk relative to a very small value proposition:
Key questions for the maintainer / spike.
mjaschen/phpgeo (mature, widely used, supports distance, bearing, polygonal containment) or a local helper does not?Bottom line: the technical risk of trying it is near zero; the technical risk of depending on it is moderate because the maintained-value is low and the underlying capability is commodity.
Stack fit. Best suited to a small-to-mid Laravel application doing occasional proximity calculations — "stores within X km of a user," delivery-radius checks, or sorting a modest result set by distance. It is a poor fit as the core of a location-based search feature at scale, where the correct answer is database-native spatial indexing (PostGIS ST_DWithin, MySQL ST_Distance_Sphere with a spatial index, or a dedicated geo service).
Migration path. Lock-in is effectively nil: swapping out means replacing one or two method calls. That cuts both ways — it is easy to adopt and easy to abandon, which lowers the cost of a bad decision but also means there is little strategic reason to adopt rather than write a 30-line helper.
Compatibility. Verify Composer constraints against the target Laravel and PHP versions before committing; a 14-star package is a plausible candidate for stale illuminate/support ranges that block a framework upgrade. Confirm auto-discovery works in the target Laravel version and that the facade (if any) resolves. Run the package's own test suite locally if present.
Sequencing.
phpgeo result) for a dozen coordinate pairs including edge cases. Confirm units and earth model.DistanceCalculator interface so call sites never import the vendor namespace directly. This preserves the option to swap to phpgeo, PostGIS, or an in-house helper without touching product code.Maintenance. Ongoing maintenance burden on our side is small but non-zero: we own upgrade compatibility when Laravel or PHP majors move, because upstream activity is unlikely. Budget for a periodic "is this still installable?" check, or plan to vendor/fork the ~40 lines into our own codebase — which is a legitimate and probably preferable end state given the size of the code.
Support. No vendor, no SLA, no paid support tier. Support is GitHub issues on a low-traffic repository, which realistically means self-support. That is acceptable for commodity math and unacceptable if the package is ever on a revenue-critical path without an adapter or fork in place.
Scaling. This is the significant operational ceiling. In-PHP distance computation cannot use an index; a radius query becomes a full scan plus per-row math. Fine for hundreds to low thousands of rows, degrading linearly beyond that. Any product requirement that smells like "nearest N to a moving user" or "filter by radius with other predicates" should route to PostGIS/MySQL spatial from the start — and then this package adds nothing.
Failure modes to watch.
Ramp-up. Essentially zero — a developer reads the README and is productive in minutes. That low ramp-up is also the honest measure of the package's value: it saves an engineer perhaps half a day of writing and testing a Haversine helper. The TPM recommendation is therefore conditional: use it only as a disposable accelerator behind an internal adapter, verify it against a reference implementation on edge cases, and treat phpgeo or database-native spatial functions as the default choice for anything that will live longer than a sprint.
How can I help you explore Laravel packages today?