2017 © Pedro Peláez
 

library geoip-location

Get the geographical location of website visitors based on their IP addresses. Support Laravel 5 and PHP (Non-Laravel) Project.

image

victorybiz/geoip-location

Get the geographical location of website visitors based on their IP addresses. Support Laravel 5 and PHP (Non-Laravel) Project.

  • Wednesday, January 17, 2018
  • by victorybiz
  • Repository
  • 1 Watchers
  • 1 Stars
  • 4,699 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 6 Versions
  • 13 % Grown

The README.md

GeoIP Location

GitHub release Software License Build Status Packagist, (*1)

Get the geographical location of website visitors based on their IP addresses. Support Laravel and PHP (Non-Laravel) Project., (*2)

Installation

Install using composer, from the command line run:, (*3)

$ composer require victorybiz/geoip-location

Laravel Project

Alternatively, you can add "victorybiz/geoip-location": "^1.1" to your composer.json file's require section and then you'll then need to run composer install or composer update to download it and have the autoloader updated., (*4)

If you use Laravel >= 5.5 you can skip this step and go to usage, (*5)

If you use Laravel < 5.5, you need to register the service provider with the application. Open up config/app.php and locate the providers key., (*6)

'providers' => [

    Victorybiz\GeoIPLocation\GeoIPLocationServiceProvider::class,

]

And add the GeoIPLocation alias to config/app.php:, (*7)

'aliases' => [

    'GeoIPLocation' => Victorybiz\GeoIPLocation\Facades\GeoIPLocationFacade::class,

]

Usage in Laravel Project

Please use the GeoIPLocation Facade, (*8)

use GeoIPLocation;

echo GeoIPLocation::getIP(); // Return client IP

PHP (Non-Laravel) Project

Require the vendor autoload file in your php script., (*9)

    require_once 'path/to/vendor/autoload.php';

Usage

Localhost IP 127.0.0.1, 192.168.65.0, 172.18.0.1 and ::1 will return 169.159.82.111 to assert a valid geo response., (*10)

    use Victorybiz\GeoIPLocation\GeoIPLocation;

    $geoip = new GeoIPLocation(); 

    // OR

    $geoip = new GeoIPLocation([
        'ip' => null, // Set IP.  Default is NULL, will be auto set by the package
        'baseCurrency' => 'USD', // Set base currency for exchange rate. Default is USD
    ]);

Alternatively, (*11)

    $geoip = new \Victorybiz\GeoIPLocation\GeoIPLocation();

    // OR

    $geoip = new \Victorybiz\GeoIPLocation\GeoIPLocation([
        'ip' => null, // Set IP.  Default is NULL, will be auto set by the package
        'baseCurrency' => 'USD', // Set base currency for exchange rate. Default is USD
    ]);

You're good to go, explore the package, (*12)

    echo $geoip->getIP(); // Return client IP

    echo $geoip->setIP('0.0.0.0'); // Set an IP to get its geographical location

    echo $geoip->getCity(); // Return client IP City (null if none)

    echo $geoip->getRegion(); // Return client IP Region (null if none)

    echo $geoip->getRegionCode(); // Return client IP Region Code (null if none)

    echo $geoip->getCountry(); // Return client IP Country

    echo $geoip->getCountryCode(); // Return client IP Country Code

    echo $geoip->getContinent(); // Return client IP Continent 

    echo $geoip->getContinentCode(); // Return client IP Continent Code

    echo $geoip->getPostalCode(); // Return client IP Postal Code (null if none)

    echo $geoip->getLatitude(); // Return client IP Latitude (null if none)

    echo $geoip->getLongitude(); // Return client IP Longitude (null if none)

    echo $geoip->getCurrencyCode(); // Return client IP Country Currency Code (null if none)

    echo $geoip->getCurrencySymbol(); // Return client IP Country Currency Symbol (null if none)

    echo $geoip->getCurrencyExchangeRate(); // Return client IP Country Currency Exchange Rate against NGN (null if none)

    echo $geoip->getLocation(); // Return client IP Location string (city, region, country)

Web Services

Bug Reports and Issue tracking

Kindly make use of the issue tracker for bug reports, feature request, additional web service request and security issues., (*13)

License

MIT, (*14)

The Versions

17/01 2018

dev-master

9999999-dev

Get the geographical location of website visitors based on their IP addresses. Support Laravel 5 and PHP (Non-Laravel) Project.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Victory Osayi

laravel geoip php laravel 5 github open source

17/01 2018

v1.0.2

1.0.2.0

Get the geographical location of website visitors based on their IP addresses. Support Laravel 5 and PHP (Non-Laravel) Project.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Victory Osayi

laravel geoip php laravel 5 github open source

18/11 2017

v1.0.1

1.0.1.0

Get the geographical location of website visitors based on their IP addresses. Support Laravel 5 and PHP (Non-Laravel) Project.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Victory Osayi

laravel geoip php laravel 5 github open source

02/08 2017

v1.0.0

1.0.0.0

Get the geographical location of website visitors based on their IP addresses.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Victory Osayi

laravel geoip php laravel 5 github open source

02/08 2017

v0.1.1

0.1.1.0

Get the geographical location of website visitors based on their IP addresses.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Victory Osayi

laravel geoip php laravel 5 github open source

01/08 2017

v0.1.0

0.1.0.0

Get the geographical location of website visitors based on their IP addresses.

  Sources   Download

MIT

The Requires

 

by Victory Osayi

laravel geoip php laravel 5 github open source