2017 © Pedro Peláez
 

library larageo-plugin

A Laravel package that uses geoPlugin web service to fetch information from an IP.

image

lithiumdev/larageo-plugin

A Laravel package that uses geoPlugin web service to fetch information from an IP.

  • Friday, February 10, 2017
  • by tsiedsma
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,575 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 8 Versions
  • 11 % Grown

The README.md

, (*1)

Laravel 5+ Geo IP Package

from Lithium Hosting
We're always open to pull requests, feel free to make this your own or help us make it better., (*2)

(c) Lithium Hosting, llc, (*3)

License

This library is licensed under the MIT license; you can find a full copy of the license itself in the file /LICENSE, (*4)

Requirements

  • Laravel 5.2+
  • php 5.5.9+
  • Knowledge of Laravel and php

Description

A Laravel package that uses geoPlugin web service to fetch information from an IP. It will store in cache the IP information and it will expire in 1 week., (*5)


Installation

Install this package through Composer. To your composer.json file, add:, (*6)

    "lithiumdev/larageo-plugin": "~1.0"

Next, run the Composer update comand, (*7)

$ composer update

Add the service provider to app/config/app.php, within the providers array., (*8)

    'providers' => array(
        // ...
        LithiumDev\LaraGeo\ServiceProvider::class,
    ),

In the same file config/app.php add the alias:, (*9)

    'aliases' => array(
        //...
        'LaraGeo'   => LithiumDev\LaraGeo\Facade::class,
    ),

Usage

You can specify an IP:, (*10)

    $info = LaraGeo::getInfo('177.34.13.248'); // get info from a IP
    var_dump($info);

Or use it without any param:, (*11)

    $info = LaraGeo::getInfo(); // get info from the IP of the user accessing the page
    var_dump($info);

This is the output:, (*12)

    object(stdClass)[155]
      public 'geoplugin_request' => string '177.34.13.248' (length=13)
      public 'geoplugin_status' => int 200
      public 'geoplugin_credit' => string 'Some of the returned data includes GeoLite data created by MaxMind, available from <a href=\'http://www.maxmind.com\'>http://www.maxmind.com</a>.' (length=145)
      public 'geoplugin_city' => string 'Campo Grande' (length=12)
      public 'geoplugin_region' => string 'Mato Grosso do Sul' (length=18)
      public 'geoplugin_areaCode' => string '0' (length=1)
      public 'geoplugin_dmaCode' => string '0' (length=1)
      public 'geoplugin_countryCode' => string 'BR' (length=2)
      public 'geoplugin_countryName' => string 'Brazil' (length=6)
      public 'geoplugin_continentCode' => string 'SA' (length=2)
      public 'geoplugin_latitude' => string '-20.450001' (length=10)
      public 'geoplugin_longitude' => string '-54.616699' (length=10)
      public 'geoplugin_regionCode' => string '11' (length=2)
      public 'geoplugin_regionName' => string 'Mato Grosso do Sul' (length=18)
      public 'geoplugin_currencyCode' => string 'BRL' (length=3)
      public 'geoplugin_currencySymbol' => string '&#82;&#36;' (length=10)
      public 'geoplugin_currencySymbol_UTF8' => string 'R$' (length=2)
      public 'geoplugin_currencyConverter' => float 2.383

Another useful example: You can also just return one field, e.g. city from in one call:, (*13)

    $userCity = LaraGeo::getInfo()->geoplugin_city; // get the city from the user IP
    var_dump($userCity);

Output:, (*14)

    string 'Campo Grande' (length=12)

More info

If you want more info about the geoPlugin web service, click here., (*15)

The Versions

10/02 2017

dev-master

9999999-dev

A Laravel package that uses geoPlugin web service to fetch information from an IP.

  Sources   Download

MIT

The Requires

 

by Troy Siedsma

laravel ipinfo geoipplugin

10/02 2017

v1.0.5

1.0.5.0

A Laravel package that uses geoPlugin web service to fetch information from an IP.

  Sources   Download

MIT

The Requires

 

by Troy Siedsma

laravel ipinfo geoipplugin

10/02 2017

v1.0.4

1.0.4.0

A Laravel package that uses geoPlugin web service to fetch information from an IP.

  Sources   Download

MIT

The Requires

 

by Troy Siedsma

laravel ipinfo geoipplugin

19/04 2016

v1.0.3

1.0.3.0

A Laravel package that uses geoPlugin web service to fetch information from an IP.

  Sources   Download

MIT

The Requires

 

by Troy Siedsma

laravel ipinfo geoipplugin

19/04 2016

v1.0.2

1.0.2.0

A Laravel package that uses geoPlugin web service to fetch information from an IP.

  Sources   Download

MIT

The Requires

 

by Troy Siedsma

laravel ipinfo geoipplugin

19/04 2016

v1.0.1

1.0.1.0

A Laravel package that uses geoPlugin web service to fetch information from an IP.

  Sources   Download

MIT

The Requires

 

by Ricardo Fuhrmann
by Troy Siedsma

laravel ipinfo geoipplugin

19/04 2016

v1.0.0

1.0.0.0

A Laravel package that uses geoPlugin web service to fetch information from an IP.

  Sources   Download

MIT

The Requires

 

by Ricardo Fuhrmann
by Troy Siedsma

laravel ipinfo geoipplugin

09/11 2015

dev-analysis-qMgvv8

dev-analysis-qMgvv8

A Laravel package that uses geoPlugin web service to fetch information from an IP.

  Sources   Download

MIT

The Requires

 

by Ricardo Fuhrmann

laravel ipinfo geoipplugin