承接 yebto/laravel-geoip-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yebto/laravel-geoip-api

Composer 安装命令:

composer require yebto/laravel-geoip-api

包简介

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

README 文档

README

Latest Version on Packagist Total Downloads

Official Laravel SDK for the YEB GeoIP API by NETOX Ltd. — a lightweight wrapper for fast and accurate IP geolocation (City, Country, ASN) in Laravel applications.

Table of Contents

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

Import the facade and start making API calls:

use GeoIPAPI;

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

  • GeoIPAPI::city(?string $ip = null)API Docs
  • GeoIPAPI::country(?string $ip = null)API Docs
  • GeoIPAPI::asn(?string $ip = null)API Docs
  • GeoIPAPI::query(string $db, ?string $ip = null)API Docs

Parameters Reference

Helper Required Optional
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

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

  • 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

🎁 Get 1,000+ free API requests by registering on yeb.to using your Google account.

Steps:

  1. Visit https://yeb.to
  2. Click Login with Google
  3. Retrieve your API key and add it to .env as YEB_KEY_ID

No credit card required!

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
  • 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

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 support@yeb.to — we’d love to hear from you!

yebto/laravel-geoip-api 适用场景与选型建议

yebto/laravel-geoip-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「geoip」 「sdk」 「laravel」 「IP」 「country」 「city」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 yebto/laravel-geoip-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 yebto/laravel-geoip-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 yebto/laravel-geoip-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 37
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-17