Giter VIP home page Giter VIP logo

laravel-4-geoip's Introduction

laravel-4-geoip

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality

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!

Requirements

  • PHP >= 5.3.7
  • cURL Extension

Installation

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

Usage

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

laravel-4-geoip's People

Contributors

d3catalyst avatar evilangelmd avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.