PHPackages                             canebaycomputers/ip-api - 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. [API Development](/categories/api)
4. /
5. canebaycomputers/ip-api

ActiveLibrary[API Development](/categories/api)

canebaycomputers/ip-api
=======================

A simple Laravel package to get IP address information from ip-api.com

1.1(1y ago)013MITPHPPHP &gt;=7.2

Since May 27Pushed 7mo agoCompare

[ Source](https://github.com/CaneBayComputers/ip-api)[ Packagist](https://packagist.org/packages/canebaycomputers/ip-api)[ RSS](/packages/canebaycomputers-ip-api/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

IpApi - IP Address Information Lookup
=====================================

[](#ipapi---ip-address-information-lookup)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ea22bcbe941c367193c53cd8cc0dec1fa3b1418e47344659222a4081a04e9f7f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c2d666163746f72792f69702d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/el-factory/ip-api)[![Total Downloads](https://camo.githubusercontent.com/d00dd2e4fed679afe8b53a4ec37b4a08c415cf985f0f2978bbc93e0f83fd6a6c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c2d666163746f72792f69702d6170693f7374796c653d666c61742d737175617265)](https://packagist.org/packages/el-factory/ip-api)[![Repo Size](https://camo.githubusercontent.com/31c64a5500d3bbe295b31af933408f4f6035439e10332ed7806240582d4dd93b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f656c2d666163746f72792f69702d6170693f7374796c653d666c61742d737175617265)](https://packagist.org/packages/el-factory/ip-api)[![Repo Size](https://camo.githubusercontent.com/f22f92894e67087b8465f2fc0200726effd3e42717d697419f776cc3fa3036eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656c2d666163746f72792f69702d6170693f7374796c653d666c61742d737175617265)](https://packagist.org/packages/el-factory/ip-api)

The `IpApi` package provides an easy-to-use interface for looking up information about IP addresses using the ip-api.com API. It allows you to fetch various details about an IP address, such as geographical location, time zone, currency, and more.

Requirements:

- PHP 7.2 or higher
- Laravel 7 or higher

Installation
------------

[](#installation)

The `IpApi` package requires Laravel version 7 or higher.

To install the package, you can use Composer:

```
composer require el-factory/ip-api
```

Configuration
-------------

[](#configuration)

After installing the package, you can optionally publish the configuration file to customize the default settings:

```
php artisan vendor:publish --tag=ip-api-config
```

This will create a `ip-api.php` file in the `config` directory of your Laravel application. You can modify the default configuration values in this file according to your specific requirements.

Usage
-----

[](#usage)

### IP Address Lookup

[](#ip-address-lookup)

To perform an IP address lookup, you can use the `lookup` method on the `IpApi` class:

```
use ElFactory\IpApi\IpApi;

$ipDetails = IpApi::default('188.216.103.93')->lookup();
```

This will return an array with the details of the provided IP address.

### Additional Configuration

[](#additional-configuration)

You can also customize the IP address lookup by using the following methods:

#### `fields(array $fields): IpApi`

[](#fieldsarray-fields-ipapi)

Set the fields to be included in the API response. The `$fields` parameter should be an array of fields you want to retrieve.

```
$ipDetails = IpApi::default('188.216.103.93')->fields(['city', 'country', 'timezone'])->lookup();
```

#### `usingKey(string $apiKey): IpApi`

[](#usingkeystring-apikey-ipapi)

By default, the package uses the API key provided in config file. If you wish to send different API key for a specific request, you can use the `usingKey` method to set the API key for that request.

```
$ipDetails = IpApi::default('188.216.103.93')->usingKey('YOUR_API_KEY')->lookup();
```

#### `retry(int $times, int $sleep): IpApi`

[](#retryint-times-int-sleep-ipapi)

Set the retry configuration for failed API requests. The `$times` parameter represents the number of retry attempts, and the `$sleep` parameter specifies the number of seconds to sleep between retries.

```
$ipDetails = IpApi::default('188.216.103.93')->retry(3, 2)->lookup();
```

#### `lang(string $language): IpApi`

[](#langstring-language-ipapi)

Set the language for the API response. The `$language` parameter should be a two-letter language code.

```
$ipDetails = IpApi::default('188.216.103.93')->lang('en')->lookup();
```

#### `withHeaders(): IpApi`

[](#withheaders-ipapi)

Include request limit and remaining requests headers in the API response.

```
$ipDetails = IpApi::default('188.216.103.93')->withHeaders()->lookup();
```

### Console Command - `ip-api:connection`

[](#console-command---ip-apiconnection)

The `IpApi` package also includes a console command named `ip-api:connection` that allows you to test the connection to the ip-api.com API with a specific IP address or your public IP address (if not provided).

To use the command, run the following Artisan command:

```
php artisan ip-api:connection {ip?}
```

- `{ip}` (optional): The IP address to test with. If not provided, the command will use your public IP address.

The command will display the details retrieved from the ip-api.com API for the provided IP address.

### Example

[](#example)

Here's an example of using the `ip-api:connection` command:

```
php artisan ip-api:connection 188.216.103.93
```

This will test the connection to ip-api.com API with the specified IP address and display the details retrieved.

If no IP address is provided, the command will automatically use your public IP address:

```
php artisan ip-api:connection
```

Exceptions
----------

[](#exceptions)

The `IpApi` class may throw the following exceptions:

- `Exception`: If the provided IP address is invalid or reserved.
- `RequestException`: If an error occurs while making the API request.

License
-------

[](#license)

The `IpApi` package is open-source software licensed under the [MIT License](https://opensource.org/licenses/MIT). Feel free to use and modify it according to your needs.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance50

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

721d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/919d4d0b4d078d29817badfe6208af160157b40c744c683d3e2ef39a3894bae1?d=identicon)[shrimpwagon](/maintainers/shrimpwagon)

---

Top Contributors

[![shrimpwagon](https://avatars.githubusercontent.com/u/101164?v=4)](https://github.com/shrimpwagon "shrimpwagon (9 commits)")

---

Tags

IP APIip-api.comip api laravelip api php

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/canebaycomputers-ip-api/health.svg)

```
[![Health](https://phpackages.com/badges/canebaycomputers-ip-api/health.svg)](https://phpackages.com/packages/canebaycomputers-ip-api)
```

###  Alternatives

[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[didww/didww-api-3-php-sdk

PHP SDK for DIDWW API 3

1218.2k](/packages/didww-didww-api-3-php-sdk)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
