PHPackages                             hamidreza2005/php-ip - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hamidreza2005/php-ip

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hamidreza2005/php-ip
====================

a package for get client's location by ip address in php

v1.0.1(5y ago)13MITPHP

Since Sep 23Pushed 5y ago1 watchersCompare

[ Source](https://github.com/hamidreza2005/php-ip)[ Packagist](https://packagist.org/packages/hamidreza2005/php-ip)[ RSS](/packages/hamidreza2005-php-ip/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

PHP IP
======

[](#php-ip)

this package helps you to find client's location by IP address in PHP🚀

installation
------------

[](#installation)

you can install this package via Composer :

```
composer require hamidreza2005/php-ip
```

Usage
-----

[](#usage)

at first you must initialize your Driver:

```
use hamidreza2005\phpIp\Geojs;
use hamidreza2005\phpIp\Ipinfo;
use hamidreza2005\phpIp\Ipapi;

$ip = new Geojs($DebugMode,$IP); //visit https://www.geojs.io/
$ip = new Ipapi(API_TOKEN,$DebugMode,$IP); // visit https://www.ipapi.com/
$ip = new Ipinfo(API_TOKEN,$JSON_FILE_PATH,$DebugMode,$IP); // visit https://www.ipinfo.io/
```

ParameterExplanationAPI\_TOKENyour API Token$JSON\_FILE\_PATH[See here](#get-country-fullname-in-ipinfo-driver)$DebugModeif you ar in debug mode and use localhost make it `true` to get your current ip not `127.0.0.1`$IPyou can use custom ip like `8.8.8.8` instead of using current ipand you can use driver's methods :

```
$ip->countryCode() // return country Code e.g DE
$ip->all() // return all Details about client's ip
$ip->coordinates() // return client's coordinates
$ip->ip() // return all client's ip
$ip->country() // return all client's country full name e.g Germany
```

**Notice :** because of every driver have different Structure you should use all method to access Details about IP

### Get Country fullname in ipinfo driver

[](#get-country-fullname-in-ipinfo-driver)

as you know there is not country fullname in ipinfo structure. so if want to use ipinfo driver and you want country fullname `e.g France` you can make a json file where you like and full `$JSON_FILE_PATH` like this :

```
