PHPackages                             yebto/laravel-geoip-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. yebto/laravel-geoip-api

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

yebto/laravel-geoip-api
=======================

Laravel SDK wrapper for the YEB GeoIP API. Fetch City, country or ASN information from any IP, with emoji flags.

v1.0.0(8mo ago)00MITPHPPHP ^8.1

Since Aug 17Pushed 8mo agoCompare

[ Source](https://github.com/yebto/laravel-geoip-api)[ Packagist](https://packagist.org/packages/yebto/laravel-geoip-api)[ Docs](https://yeb.to)[ RSS](/packages/yebto-laravel-geoip-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Laravel GeoIP API SDK
=====================

[](#laravel-geoip-api-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/608e5d5f75f72997cc22a5df6a049390908f843e951a71c9245fef9e977a0959/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796562746f2f6c61726176656c2d67656f69702d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yebto/laravel-geoip-api)[![Total Downloads](https://camo.githubusercontent.com/3cf18750a915a7686c2633c534faa57183bc04ad11b4e862fb3a1d2314a9c09d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f796562746f2f6c61726176656c2d67656f69702d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yebto/laravel-geoip-api)

Official Laravel SDK for the **[YEB GeoIP API](https://yeb.to/api/geoip)** by [NETOX Ltd.](https://yeb.to/about) — a lightweight wrapper for fast and accurate **IP geolocation** (City, Country, ASN) in Laravel applications.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Available Methods](#available-methods)
- [Parameters Reference](#parameters-reference)
- [Configuration](#configuration)
- [Features](#features)
- [Free Tier Access](#free-tier-access)
- [Troubleshooting](#troubleshooting)
- [Support](#support)
- [License](#license)

---

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

[](#installation)

Install the package using Composer:

```
composer require yebto/laravel-geoip-api
```

Publish the configuration file:

```
php artisan vendor:publish --tag=geoipapi-config
```

Add your API key to your `.env` file:

```
YEB_KEY_ID=your_api_key_here
```

---

Usage
-----

[](#usage)

Import the facade and start making API calls:

```
use GeoIPAPI;
```

### Examples

[](#examples)

**1) City Lookup**

```
$city = GeoIPAPI::city('21.85.7.138');

// Sample shape:
// $city['data'] => [
//   'ip', 'hostname', 'city', 'region', 'country', 'loc', 'org', 'postal', 'timezone', ...
// ]
```

**2) Country Lookup**

```
$country = GeoIPAPI::country('85.85.7.138');

// Sample shape:
// $country['data'] => [
//   'ip', 'country', 'country_name', 'isEU', 'country_flag',
//   'continent' => ['code', 'name'],
// ]
```

**3) ASN Lookup**

```
$asn = GeoIPAPI::asn('55.85.7.138');

// Sample shape:
// $asn['data'] => [ 'ip', 'org', 'asn', 'network' ]
```

**4) Generic Query**

```
$response = GeoIPAPI::query('city', '77.85.7.138');
// Supported databases: 'city', 'country', 'asn'
```

> 💡 If the IP is omitted (e.g. `GeoIPAPI::city();`), the backend uses the requester's IP automatically via `Request::ip()`.

**5) Error Handling**

```
try {
    $city = GeoIPAPI::city('67.85.7.138');
} catch (\RuntimeException $e) {
    // Log or handle the error
    \Log::error($e->getMessage());
}
```

---

Available Methods
-----------------

[](#available-methods)

- `GeoIPAPI::city(?string $ip = null)` – [API Docs](https://yeb.to/api/geoip)
- `GeoIPAPI::country(?string $ip = null)` – [API Docs](https://yeb.to/api/geoip)
- `GeoIPAPI::asn(?string $ip = null)` – [API Docs](https://yeb.to/api/geoip)
- `GeoIPAPI::query(string $db, ?string $ip = null)` – [API Docs](https://yeb.to/api/geoip)

---

Parameters Reference
--------------------

[](#parameters-reference)

HelperRequiredOptional`city``ip` (when not auto-detected)–`country``ip` (when not auto-detected)–`asn``ip` (when not auto-detected)–`query``db` (`city` | `country` | `asn`)`ip` (when not auto-detected)> 💡 All methods accept additional parameters supported by the API, which will be forwarded transparently.

---

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

[](#configuration)

The SDK uses a single environment variable:

```
YEB_KEY_ID=your_api_key_here
```

You may customize other configuration settings via `config/geoipapi.php` after publishing:

```
return [
    'base_url' => 'https://api.yeb.to/v1/', // default
    'key'      => env('YEB_KEY_ID'),
    'curl'     => [
        CURLOPT_TIMEOUT   => 3,
        CURLOPT_USERAGENT => 'Laravel-GeoIP-Client',
        // Add more cURL options as needed
    ],
];
```

---

Features
--------

[](#features)

- Simple, expressive API via a Laravel Facade
- City, Country, and ASN lookups
- Auto-detects the requester IP when omitted
- Small footprint — no local databases to maintain
- Customizable cURL options (timeouts, user agent, etc.)
- Clean error handling with `RuntimeException` on failed requests
- Built for Laravel; zero-config auto-discovery

---

Free Tier Access
----------------

[](#free-tier-access)

🎁 Get **1,000+ free API requests** by registering on [yeb.to](https://yeb.to) using your **Google account**.

**Steps:**

1. Visit ****
2. Click **Login with Google**
3. Retrieve your API key and add it to `.env` as `YEB_KEY_ID`

*No credit card required!*

---

Troubleshooting
---------------

[](#troubleshooting)

- Ensure your API key is correct and active (`YEB_KEY_ID`)
- Double-check that the config file is published (`php artisan vendor:publish --tag=geoipapi-config`)
- Validate parameters against the [API reference](https://yeb.to/api/geoip)
- Check for typos in method names or required fields
- Consider adjusting `CURLOPT_TIMEOUT` in `config/geoipapi.php` for slower networks
- Inspect your application/network firewall rules if requests time out

---

Support
-------

[](#support)

- 📘 API Documentation: ****
- 📧 Email: ****
- 🐛 Issues: ****

---

License
-------

[](#license)

© NETOX Ltd. Licensed under a proprietary or custom license unless stated otherwise in the repository.

> 💬 Have a feature request or improvement idea? Reach out at **** — we’d love to hear from you!

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance58

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

268d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/57d7e2ce619fb0a25c0b8ebf53ab60f9aba259cbb926f697dc0cb6b5349dea85?d=identicon)[yebto](/maintainers/yebto)

---

Top Contributors

[![yebto](https://avatars.githubusercontent.com/u/217711937?v=4)](https://github.com/yebto "yebto (5 commits)")

---

Tags

laravelgeoipsdkIPcountrycityasnyeb

### Embed Badge

![Health badge](/badges/yebto-laravel-geoip-api/health.svg)

```
[![Health](https://phpackages.com/badges/yebto-laravel-geoip-api/health.svg)](https://phpackages.com/packages/yebto-laravel-geoip-api)
```

###  Alternatives

[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[dougsisk/laravel-country-state

Country &amp; state helper for Laravel.

1681.7M](/packages/dougsisk-laravel-country-state)[dipeshsukhia/laravel-country-state-city-data

Country State City Data Provider

8230.8k](/packages/dipeshsukhia-laravel-country-state-city-data)[adrianorosa/laravel-geolocation

Laravel Geo Location package to get details for a given IP Address

6593.3k1](/packages/adrianorosa-laravel-geolocation)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[usamamuneerchaudhary/country-city-state

Country City State Data Provider for Laravel 12+

242.6k](/packages/usamamuneerchaudhary-country-city-state)

PHPackages © 2026

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