- Is develia/geo-bundle compatible with Laravel 10/11, or does it require Symfony-specific tweaks?
- The bundle is PHP-based and not Laravel-native, so you’ll need to wrap its logic in a Laravel service provider and facades (e.g., `GeoServiceProvider`). It uses Symfony components, which Laravel already supports, but test for version conflicts with `composer why-not`. Start with Laravel 10.x for stability.
- Can this bundle handle geocoding (e.g., address-to-coordinates) or just coordinate calculations?
- The bundle focuses on coordinate validation, distance/radius calculations, and formatting—not geocoding APIs. For geocoding, pair it with a service like OpenStreetMap or Google Maps via Laravel HTTP clients, then cache results with Redis to avoid rate limits.
- How do I store coordinates in the database? Does it work with Eloquent or require raw SQL?
- Use standard database columns (e.g., `latitude DECIMAL(10,8)`, `longitude DECIMAL(11,8)`) or spatial types like PostGIS if your DB supports it. The bundle provides validation helpers for Eloquent models, but complex queries (e.g., `WHERE distance < 5km`) may need raw SQL or a Laravel Query Builder extension.
- Are there alternatives like spatie/laravel-geotools that are more Laravel-native?
- Yes, `spatie/laravel-geotools` is a more mature Laravel package with built-in Eloquent support, PostGIS integration, and geocoding helpers. If you’re starting fresh, it’s likely a better fit. This bundle is lighter but requires manual Laravel integration.
- How do I validate user-uploaded coordinates (e.g., ensure they’re within a country or valid range)?
- Use the bundle’s `GeoValidator` class to check ranges (e.g., `-90 ≤ lat ≤ 90`) and malformed inputs. For country/region validation, combine it with a geocoding API or a database of bounding boxes, then cache results to avoid repeated lookups.
- Does this bundle support real-time location tracking (e.g., WebSockets) or just static data?
- The bundle handles static geo data and calculations. For real-time tracking, pair it with Laravel Echo/Pusher and store updates in a database. Use Redis for pub/sub if you need low-latency location broadcasts.
- What’s the performance impact of distance calculations on large datasets (e.g., 100K+ records)?
- Distance calculations (e.g., Haversine) are lightweight for small datasets but can slow down queries on large tables. Offload heavy computations to database spatial indexes (PostGIS) or pre-calculate distances during batch jobs. Test with `tightenco/bench` to identify bottlenecks.
- Can I use this with MySQL instead of PostgreSQL/PostGIS?
- Yes, but enable MySQL’s spatial extension (`spatial` engine) for advanced queries. The bundle itself doesn’t require PostGIS, but complex operations (e.g., polygon intersections) will perform better with PostGIS. Stick to basic lat/lng storage for MySQL.
- How do I integrate this with frontend maps (e.g., Leaflet.js or Mapbox)?
- The bundle is backend-only. Pass coordinates via Laravel Blade, Inertia.js, or API responses to your frontend. Use JavaScript libraries like Leaflet to render maps, and handle user interactions (e.g., marker clicks) via AJAX calls to Laravel endpoints.
- Is there documentation or testing coverage? What if I need custom geo features?
- The bundle lacks extensive public documentation or tests, so expect to rely on the README and source code. For custom features (e.g., geofencing), extend the bundle’s service classes or create a Laravel package wrapper. Plan for manual testing of edge cases like invalid coordinates or timezone offsets.