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

Last update: Feb 18, 2021

LarageoPlugin (Laravel 4 Package)

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.


Installation

Install this package through Composer. To your composer.json file, add:

    "fuhrmann/larageo-plugin": "dev-master"

Next, run the Composer update comand

$ composer update

Add the service provider to app/config/app.php, within the providers array.

    'providers' => array(
        // ...
        'Fuhrmann\LarageoPlugin\ServiceProvider',
    ),

In the same file config/app.php add the alias:

    'aliases' => array(
        //...
        'LarageoPlugin'   => 'Fuhrmann\LarageoPlugin\Facade',
    ),

Usage

You can specify an IP:

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

Or use it without any param:

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

This is the output:

    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 http://www.maxmind.com.' (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 'R$' (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:

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

Output:

    string 'Campo Grande' (length=12)

More info

If you want more info about the geoPlugin web service, click here.

GitHub

https://github.com/Fuhrmann/larageo-plugin
You might also like...

This project processes a small database with php all on a web server. This project uses XAMPP to run the web server and the database.

PHP-introduction This project processes a small database with php all on a web server. This project uses XAMPP to run the web server and the database.

Jan 6, 2022

The HttpClient component provides powerful methods to fetch HTTP resources synchronously or asynchronously.

HttpClient component The HttpClient component provides powerful methods to fetch HTTP resources synchronously or asynchronously. Resources Documentati

Aug 8, 2022

a Telegram bot to fetch download link from pan.baidu.com

baiduwp-bot a Telegram bot to fetch download link from pan.baidu.com What it can do Get a file download link from share link. 从分享链接获取下载地址 How to use G

Jul 28, 2022

A simple, type-safe, zero dependency port of the javascript fetch WebApi for PHP.

A simple, type-safe, zero dependency port of the javascript fetch WebApi for PHP.

A simple, type-safe, zero dependency port of the javascript fetch WebApi for PHP.

Aug 10, 2022

Fetch instagram photos without the need for app aproval

Fetch instagram photos without the need for app aproval. This plugin will download the photos and/or video thumbnails to local storage. All media will be stored in a json file.

Apr 11, 2022

Tiny php mysql lib (PDO-based) with handy fetch/update functionality, supports both SQL and parametric queries

Micro PHP mysql lib (~ 200 lines of code) with ultra powerful CRUD for faster than ever development: parametric fetch/insert/update/delete (based on a

Feb 22, 2022

Fetch is a library for reading email and attachments, primarily using the POP and IMAP protocols

Fetch Fetch is a library for reading email and attachments, primarily using the POP and IMAP protocols. Installing N.b. A note on Ubuntu 14.04 (probab

Jul 30, 2022

Until 2018, Backpack v3 used this Base package to offer admin authentication and a blank admin panel using AdminLTE. Backpack v4 no longer uses this package, they're now built-in - use Backpack/CRUD instead.

Until 2018, Backpack v3 used this Base package to offer admin authentication and a blank admin panel using AdminLTE. Backpack v4 no longer uses this package, they're now built-in - use Backpack/CRUD instead.

Note: This package is only used by Backpack v3. Starting with Backpack v4, everything this package does is included in Backpack/CRUD - one package to

Aug 13, 2022

A laravel service provider for the netsuite-php library service

netsuite-laravel A PHP supplemental package to the ryanwinchester/netsuite-php package to add the NetSuite service client to the service container of

Jun 2, 2022

A package that uses blade templates to control how markdown is converted to HTML inside Laravel, as well as providing support for markdown files to Laravel views.

A package that uses blade templates to control how markdown is converted to HTML inside Laravel, as well as providing support for markdown files to Laravel views.

Install Install via composer. $ composer require olliecodes/laravel-etched-blade Once installed you'll want to publish the config. $ php artisan vendo

Jul 5, 2021

Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.

TARS - A Linux Foundation Project TARS Foundation Official Website TARS Project Official Website WeChat Group: TARS01 WeChat Offical Account: TarsClou

Aug 8, 2022

SleekwareDB is a NoSQL database storage service. A database storage service that can be used for various platforms and is easy to integrate.

SleekwareDB is a NoSQL database storage service. A database storage service that can be used for various platforms and is easy to integrate.

SleekwareDB is a NoSQL database storage service. A database storage service that can be used for various platforms and is easy to integrate. NoSQL API

Aug 3, 2022

A CLI tool to check whether a specific composer package uses imported symbols that aren't part of its direct composer dependencies

A CLI tool to analyze composer dependencies and verify that no unknown symbols are used in the sources of a package. This will prevent you from using "soft" dependencies that are not defined within your composer.json require section.

Aug 8, 2022

Extracts information about web pages, like youtube videos, twitter statuses or blog articles.

Extracts information about web pages, like youtube videos, twitter statuses or blog articles.

Essence is a simple PHP library to extract media information from websites, like youtube videos, twitter statuses or blog articles. If you were alread

Aug 15, 2022

BaiCloud-cms is a powerful open source CMS that allows you to create professional websites and scalable web applications. Visit the project website for more information.

BaiCloud-cms About BaiCloud-cms is a powerful open source CMS that allows you to create professional websites and scalable web applications. Visit the

Feb 2, 2022

This script scrapes the HTML from different web pages to get the information from the video and you can use it in your own video player.

XVideos PornHub RedTube API This script scrapes the HTML from different web pages to get the information from the video and you can use it in your own

Jul 31, 2022

A php package to get the server information.

A php package to get you the server information Install Via Composer $ composer require ameetroy/server Usage use BubbleGum\Sweety; $getTotalSpace =

May 23, 2022

Miolica: an e-commerce application that uses React.js as the frontend and Laravel as the backend

Miolica: an e-commerce application that uses React.js as the frontend and Laravel as the backend

Miolica: an e-commerce application that uses React.js as the frontend and Laravel as the backend

Apr 20, 2022

An interface for the administrator to easily change application settings. Uses Laravel Backpack

An interface for the administrator to easily change application settings. Uses Laravel Backpack

Backpack\Settings An interface for the administrator to easily change application settings. Uses Laravel Backpack. Works on Laravel 5.2 to Laravel 8.

Jul 26, 2022
Comments
  • 1. Added support for ipv6

    Changed the way the IP is cached to use a hex of the IP which is generated from a new method called ipToHex Also added the FILTER_FLAG_IPV6 to the validateIp method. Also added geoplugin_cached to the response for easily checking if the IP is in the cache Finally, modified the 404 response detection to check if the geoplugin_status property isset in the response.

    Reviewed by lhdev at 2014-10-30 14:34
  • 2. Fix for $this in Cache closure.

    $this is not permited in a closure in PHP 5.3. This workaround solves this issue. Please feel free to change it if you know a better solution.

    Cheers, MichMich.

    Reviewed by MichMich at 2013-10-14 11:31
  • 3. Documentation actualization

    Documentation actualization. Laravel doesn´t use the array() method anymore for Aliases and Providers, just [], so it was changed that way. Also, the getInfo() method is not static, and calling it this way causes an error in Laravel. (In PHP raw may work, but it is not recomendable to do it anyway) So it was changed from the :: operator to ->

    Reviewed by SantiSnow at 2021-02-19 01:23
A Laravel package to get the user's country using the ip.

Laravel IP Service Tries to guess the country code of the client, using his IP. Installation Download and import the ip database from ip2nation.com Us

Apr 12, 2022
GeoSpatial integration on Laravel 5.2+ that supports MySQL and PostgreSQL.

Features GeoSpatial integration on Laravel 5.2+: Create geospatial columns using Schema and migrations Save and retrieve geospatial attributes using d

May 22, 2022
Damn Vulnerable Web Services is an insecure web application with multiple vulnerable web service components that can be used to learn real world web service vulnerabilities.
Damn Vulnerable Web Services is an insecure web application with multiple vulnerable web service components that can be used to learn real world web service vulnerabilities.

Damn Vulnerable Web Services is an insecure web application with multiple vulnerable web service components that can be used to learn real world web service vulnerabilities.

Jul 9, 2022
A simple PHP scripting application which fetch emails from your Gmail account according to a filter and parses them for information.

A simple PHP scripting application which fetch emails from your Gmail account according to a filter and parses them for information.

Jan 18, 2022
Newsprint is a simple web application that will fetch the front page of a newspaper and display it on an eink display
Newsprint is a simple web application that will fetch the front page of a newspaper and display it on an eink display

Newsprint is a simple web application that will fetch the front page of a newspaper and display it on an eink display. The specific resolutions and sizes have been setup to work with a 32" eInk place & play display from Visionect but can be modified for other screen resolutions.

Aug 6, 2022
A simple Lumen web app to send basic commands and fetch the current status to your Ford vehicle with Sync 3 enabled

FordPass Access This is a simple Lumen web app to send basic commands and fetch the current status to your Ford vehicle with Sync 3 enabled. Local dev

Apr 27, 2022
A Laravel package to fetch Open Graph data of a website.
A Laravel package to fetch Open Graph data of a website.

OpenGraph is a laravel package to fetch Open Graph metadata of a website/link. Features Easily fetch metadata of a URL. Laravel OpenGraph fetches all

Aug 3, 2022
CRUD Build a system to insert student name information, grade the class name, and edit and delete this information
CRUD  Build a system to insert student name information, grade the class name, and edit and delete this information

CRUD Build a system to insert student name information, grade the class name, and edit and delete this information

Aug 4, 2022
Package to fetch cryptocurrency price, market value, assets etc. using coincap API endpoints

cryptocap-pkg Package to fetch cryptocurrency price, market value, assets etc. using coincap API endpoints. This package was developed to work with co

Jun 19, 2022