tiran133/ipinfodb-php

There is no license information available for the latest version (v0.1.4) of this package.

PHP IP to Country for https://ipinfodb.com/api

v0.1.4 2022-07-20 06:27 UTC

This package is auto-updated.

Last update: 2025-05-21 05:35:33 UTC


README

How to install:

Install Package

composer require tiran133/ipinfodb-php

Publish Config

php artisan vender:publish --provider="Tiran133\Laravel\IPInfoDBServiceProvider"

Add your api key to .env

IPINFODB_API_KEY=<Your IP Key>

How to use:

Via Facade:

Country:

$country = \Tiran133\Laravel\Facade\IPInfo::getCountry($ip);
 
$country->countryName;
$country->countryCode;

City:

$city = \Tiran133\Laravel\Facade\IPInfo::getCity($ip);
 
$city->countryName;
$city->countryCode;
$city->regionName;
$city->cityName;
$city->zipCode;
$city->latitude;
$city->longitude;
$city->timeZone;

Via app()

Country:

$ipinfo =  app('ipinfodb');
$country = $ipinfo->getCountry($ip);     
 
$country->countryName;
$country->countryCode;

City:

$city = \Tiran133\Laravel\Facade\IPInfo::getCity($ip);
 
$city->countryName;
$city->countryCode;
$city->regionName;
$city->cityName;
$city->zipCode;
$city->latitude;
$city->longitude;
$city->timeZone;