Download the PHP package devrabiul/laravel-geo-genius without Composer
On this page you can find all versions of the php package devrabiul/laravel-geo-genius. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download devrabiul/laravel-geo-genius
More information about devrabiul/laravel-geo-genius
Files in devrabiul/laravel-geo-genius
Package laravel-geo-genius
Short Description Laravel GeoGenius β A powerful, intelligent toolkit for geo-location, timezone, and locale-based features in Laravel applications.
License MIT
Homepage https://github.com/devrabiul/laravel-geo-genius
Informations about the package laravel-geo-genius
π¦ Laravel GeoGenius β Timezone, Geolocation, Multilingual Toolkit & Country Picker for Laravel
Laravel GeoGenius is a lightweight, flexible package for Laravel applications that handles:
- π Geolocation β Detect user location via IP
- π Timezone Management β Detect and convert user timezones automatically
- π·οΈ Multilingual & Translation Support β Auto-detect locale, translate messages, and even convert numbers
- π± Country Picker & Phone Validation β Auto-detect default country, show a dropdown of all countries, format and validate numbers automatically
It automatically retrieves detailed IP-based location data, detects the userβs timezone, sets the correct locale, and even initialises a fully-functional phone input field with country picker and validation β all seamlessly integrated into your app.
β Fully compatible with Livewire, works via cookies or headers, and enables a truly global-ready Laravel application.
Featured On
Iβm proud to share that GeoGenius was featured on Laravel News in their article: βGeoGenius Package for Laravelβ.
Read it here: GeoGenius Package for Laravel β Laravel News
π Live Demo
π Try the Live Demo
β¨ Key Features
- π Automatic Timezone Detection β via cookies, headers, or fallback strategies
- π§ Timezone Conversion Helpers β convert timestamps automatically
- π± Country Picker & Phone Validation β detect visitorβs country, show dropdown, format & validate numbers
- β‘ Lightweight & Dependency-Free β no jQuery or frontend frameworks required
- π Livewire Compatible β works seamlessly with Livewire apps
- π§ Configurable Detection Strategy β customise detection method per app requirements
- π¦ Migration & Artisan Support β add
timezone
column effortlessly - π Caching & Offline Support β reduces API calls and handles offline gracefully
- π Multilingual Ready β built-in translation and auto-translation support
Under the hood, it leverages reliable IP geolocation APIs like ipwho.is
and ip-api.com
with caching for optimal performance.
π¦ Installation
Publish the configuration and migration stub:
β‘ Quick Start
Use Laravel GeoGenius in two ways:
- β
Global Helper β
laravelGeoGenius()
(recommended) - π§° Service Class β manually instantiate
GeoLocationService
Global Helper
Service Class
π Multilingual & Translation
Built-in auto translation and number conversion:
Configure in config/laravel-geo-genius.php
:
π Translation Artisan Commands
Laravel GeoGenius provides a set of helpful artisan commands to manage languages and translations easily:
Command | Description |
---|---|
php artisan geo:add-language {locale} |
Create a new language directory with starter files (e.g. en , bn ). |
php artisan geo:translations-generate --locale={locale} |
Scan your app for translate('...') calls and auto-generate messages.php . |
php artisan geo:translate-language {locale} --count={n} |
Translate up to n messages from new-messages.php into messages.php . |
php artisan geo:translate-language-all {locale} --count={n} |
Keep running batch translations until all strings are translated. |
php artisan geo:translate-language-batch {locale} --count={n} |
Translate a fixed batch of n messages at a time. |
Examples
π Change Current User Language
You can programmatically change the current user's language using the changeUserLanguage
method:
`
Supported locale codes depend on your configuration (
config/laravel-geo-genius.php
) and the languages you have added viageo:add-language
.
π Timezone Artisan Commands
Laravel GeoGenius ships with helpful artisan commands:
Command | Description |
---|---|
php artisan geo:add-language {locale} |
Add a new language (e.g. en , bn ) to your app. |
Examples
`
π Timezone Detection & Conversion
π Timezone Artisan Commands
Laravel GeoGenius ships with helpful artisan commands:
Command | Description |
---|---|
php artisan geo:add-timezone-column {table} |
Add a nullable timezone column to the specified table if it does not exist. |
Examples
`
π± Country Picker & Phone Input
Laravel GeoGenius makes it trivial to initialise a country-aware phone input field:
- Auto-detects visitorβs default country
- Displays country dropdown (or restrict to one country)
- Formats phone numbers as the user types
- Provides built-in validation for numbers
Quick Blade Example
GeoGenius injects the detected country code into a hidden span:
Then you can use intl-tel-inputβs API to validate on submit:
All scripts/styles are included automatically by
initIntlPhoneInput()
β you only need to add the<input>
and optionally the validation snippet.
π§ Additional Notes
- π APIs Used: ipify.org, ipwho.is
- π Caching: Geo data cached 7 days per IP (
ttl_minutes
= cache lifetime in minutes) - βοΈ Fallback: Returns default structure if offline
- π§ͺ Localhost Handling: Fetches external IP for
127.0.0.1
or::1
π€ Contributing
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Report bugs through GitHub Issues.
π± Treeware
This package is Treeware. If you use it in production, please buy the world a tree to thank us for our work. Your support helps create employment for local families and restores wildlife habitats.
π License
MIT License. See LICENSE for details.
π¬ Support
- π§ Email: [email protected]
- π GitHub: devrabiul/laravel-geo-genius
- π¦ Packagist: packagist.org/packages/devrabiul/laravel-geo-genius
π Changelog
See CHANGELOG.md for recent changes and updates.