Package Data | |
---|---|
Maintainer Username: | evilangelmd |
Maintainer Contact: | buonzz@gmail.com (Darwin Biler) |
Package Create Date: | 2015-01-29 |
Package Last Update: | 2017-05-16 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 15:01:23 |
Package Statistics | |
---|---|
Total Downloads: | 16 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Laravel 4 Library for calling http://ip-api.com/ API.
In contrary to all other packages wherein it requires that you have the geoip database in your filesystem, this library calls a free service So you dont really have to worry about downloading and maintaining geoip data from Maxmind in your own server.
Just install the package, add the config and it is ready to use!
Add in composer.json
"d3catalyst/l4-geoip": "dev-master"
Add the service provider and facade in your config/app.php
Service Provider
D3Catalyst\GeoIP\Laravel4\ServiceProviders\GeoIPServiceProvider
Facade
'GeoIP' => 'D3Catalyst\GeoIP\Laravel4\Facades\GeoIP',
Set IP of the visitor (Optional)
GeoIP::setIp("127.0.0.1"); // Optional set ip, when not set this take automatical from REMOTE_HOST
Get country of the visitor
GeoIP::getCountry(); // returns "United States"
Get country code of the visitor
GeoIP::getCountryCode(); // returns "US"
Get region of the visitor
GeoIP::getRegion(); // returns "New York"
Get region code of the visitor
GeoIP::getRegionCode(); // returns "NY"
Get city of the visitor
GeoIP::getCity(); // returns "Buffalo"
Get zip code of the visitor
GeoIP::getZipCode(); // returns "14221"
Get latitude of the visitor
GeoIP::getLatitude(); // returns "42.9864"
Get longitude of the visitor
GeoIP::getLongitude(); // returns "-78.7279"
Get timezone of the visitor
GeoIP::getTimezone(); // returns "America/Mexico_City"
Get ISP of the visitor
GeoIP::getIsp(); // returns "Internet Service provider"
Get ALL geo information of visitor
GeoIP::getAll(); // returns array with all information