- What Laravel versions does Laravel GeoGenius support?
- Laravel GeoGenius is fully compatible with Laravel 8, 9, and 10. The package follows Laravel’s semantic versioning, so it’s regularly updated to ensure compatibility with newer releases. Always check the package’s changelog or the GitHub repository for the latest version-specific notes.
- How does the geolocation API work, and what if it fails?
- The package uses free APIs like ipwho.is and ip-api.com for geolocation. If the primary API fails, it includes fallback strategies and a 7-day caching mechanism to reduce external calls. For production, monitor API reliability and consider a paid tier if your traffic exceeds free limits.
- Can I store geolocation data in the database instead of the session?
- Yes, the package provides migrations to add timezone columns to your users table. You can manually persist geolocation data in the database for authenticated users, while still relying on sessions for transient data. This is useful for multi-tenant apps or when users log in from different locations.
- Does Laravel GeoGenius work with Livewire for real-time updates?
- Yes, the package is explicitly designed for Livewire compatibility. Timezone and locale changes detected via Livewire components will update dynamically, making it ideal for dashboards, chat apps, or any real-time feature requiring geolocation-aware UI elements.
- How do I disable auto-translation if I only need manual translations?
- You can disable auto-translation by setting `auto_translate` to `false` in the `config/laravel-geo-genius.php` file. This prevents unnecessary API calls to translation services and reduces overhead. Manual translations via Laravel’s built-in localization system will still work.
- Is the country picker and phone validation compatible with Alpine.js or Inertia.js?
- The country picker and phone validation rely on intl-tel-input, which works with Alpine.js and Inertia.js out of the box. However, ensure your frontend build tool (Vite, Webpack) isn’t stripping or minifying the auto-injected scripts. Test in your specific setup to confirm compatibility.
- What’s the performance impact of geolocation API calls in production?
- Geolocation API calls introduce ~100–300ms latency, depending on network conditions. To mitigate this, enable caching (default 7-day TTL) and consider pre-fetching geolocation data during user login or using edge caching (e.g., Redis) for high-traffic apps.
- How do I handle GDPR/CCPA compliance for IP-based geolocation?
- The package doesn’t store IP addresses by default—only derived data like country, timezone, or locale. However, ensure your privacy policy discloses geolocation collection and provide an opt-out mechanism (e.g., via cookies or user preferences) if required by law.
- Are there alternatives to Laravel GeoGenius for geolocation in Laravel?
- Alternatives include `spatie/laravel-geolocation` (for manual IP lookups) or `geoip2/geoip2` (for self-hosted databases). However, Laravel GeoGenius stands out with its built-in timezone, locale, and phone validation features, making it a more comprehensive solution for global apps.
- How do I customize the phone validation rules or country picker?
- The package uses intl-tel-input for phone validation, which supports customization via its [official documentation](https://intl-tel-input.com/). You can extend the package’s `CountryPicker` class or override its views to modify the dropdown or validation logic. Check the `resources/views` folder for templates.