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

Overview

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.

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.

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

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

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

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

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.

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.

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

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

Mail Api for fetch or send mails

flux-mail-api Mail Api for fetch or send mails Installation Native Download RUN (mkdir -p /%path%/libs/flux-mail-api && cd /%path%/libs/flux-mail-api

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

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

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.

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

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

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

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

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

A web application built on PHP for user to view their credit information in their mysql database
A web application built on PHP for user to view their credit information in their mysql database

TheCreditInfo Table of Content About Inspiration Technologies Client Pages Usage About Credere is a website created to help you track your credit hist

Comments
  • Added support for ipv6

    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.

    opened by tsiedsma 1
  • Fix for $this in Cache closure.

    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.

    opened by MichMich 0
  • Documentation actualization

    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 ->

    opened by SantiSnow 0
Owner
Ricardo Fuhrmann
development, hacking, linux and another stuff
Ricardo Fuhrmann
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

Dimitris Savvopoulos 119 Nov 29, 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

Eleven 47 Dec 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.

Sam Sanoop 416 Dec 17, 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.

Haitham Sweilem 1 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. 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.

Greg Raiz 199 Dec 20, 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

Sam 4 Nov 21, 2022
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

Shashi Prakash Gautam 128 Dec 24, 2022
A PHP/Laravel package to fetch Notion Pages and convert it to HTML!

Generate HTML from Notion Page This package converts all the blocks in a Notion page into HTML using Notion's API. For more details on Notion API, ple

Usama Rehan 4 Nov 23, 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

Sajjad 2 Aug 14, 2022