manka / geo-ip
A simple GeoIP package for Laravel to get location details from an IP address.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/manka/geo-ip
Requires
- php: >=8.0
- illuminate/support: ^9.0|^10.0|^11.0|^12.0
README
Laravel GeoIP is a simple package to retrieve geographical location data from an IP address using the ip-api.com API.
🔧 Installation
Install via Composer:
composer require manka/geo-ip If you're using Laravel <5.5, you must manually register the service provider in config/app.php: ```php 'providers' => [ // ... manka\GeoIP\GeoIPServiceProvider::class, ],
⚙️ Configuration Publish the configuration file (optional):
php artisan vendor:publish --tag=config
This will create a config/geoip.php file you can modify.
🚀 Usage Use the package like this:
use GeoIP; $location = GeoIP::lookup(); // Uses current request IP $customLocation = GeoIP::lookup('8.8.8.8'); // Pass a specific IP dd($location);
Sample Output
{
"status": "success",
"country": "United States",
"regionName": "California",
"city": "Mountain View",
"zip": "94043",
"lat": 37.422,
"lon": -122.084,
"timezone": "America/Los_Angeles",
"isp": "Google LLC",
"query": "8.8.8.8"
}
✅ Features
- Get geo location from IP address
- Automatically detect current IP
- Simple API, no setup required
- Uses public API (ip-api.com)
Developed with ❤️ by Pawan Manka