定制 bigdatacloudapi/bigdatacloud 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

bigdatacloudapi/bigdatacloud

Composer 安装命令:

composer require bigdatacloudapi/bigdatacloud

包简介

Official PHP SDK for BigDataCloud APIs — IP Geolocation, Reverse Geocoding, Phone & Email Verification, Network Engineering

README 文档

README

Packagist License: MIT PHP

Official PHP SDK for BigDataCloud APIs. Strongly-typed client for IP Geolocation, Reverse Geocoding, Phone & Email Verification, and Network Engineering.

Zero external dependencies — requires only ext-curl and ext-json.

Installation

composer require bigdatacloudapi/bigdatacloud

API Key

Get a free API key at bigdatacloud.com/login. No credit card required.

export BIGDATACLOUD_API_KEY=your-key-here

Quick Start

use BigDataCloud\BigDataCloudClient;

// Reads BIGDATACLOUD_API_KEY from environment
$client = BigDataCloudClient::fromEnvironment();

// Or pass the key directly
// $client = new BigDataCloudClient('your-key-here');

// IP Geolocation
$geo = $client->ipGeolocation->get('1.1.1.1');
echo "{$geo->location->city}, {$geo->country->name}\n";

// Reverse Geocoding
$place = $client->reverseGeocoding->reverseGeocode(-33.87, 151.21);
echo "{$place->city}, {$place->countryName}\n";

// Phone Validation — countryCode is required
$phone = $client->verification->validatePhone('+61412345678', 'AU');
echo "Valid: " . ($phone->isValid ? 'yes' : 'no') . ", Type: {$phone->lineType}\n";

// Email Verification
$email = $client->verification->verifyEmail('user@example.com');
echo "Valid: " . ($email->isValid ? 'yes' : 'no') . ", Disposable: " . ($email->isDisposable ? 'yes' : 'no') . "\n";

Confidence Area

The confidenceArea field may encode multiple polygons. Use the helper:

use BigDataCloud\ConfidenceAreaHelper;

$geo = $client->ipGeolocation->getWithConfidenceArea('1.1.1.1');
$polygons = ConfidenceAreaHelper::splitIntoPolygons($geo->confidenceArea);
foreach ($polygons as $i => $ring) {
    echo "Ring " . ($i + 1) . ": " . count($ring) . " points\n";
}

Available APIs

Client Methods
$client->ipGeolocation get, getWithConfidenceArea, getFull, getCountryByIp, getCountryInfo, getAllCountries, getHazardReport, getUserRisk, getAsnInfo, getNetworkByIp, getTimezoneByIanaId, getTimezoneByIp, parseUserAgent
$client->reverseGeocoding reverseGeocode, reverseGeocodeWithTimezone, getTimezoneByLocation
$client->verification validatePhone, validatePhoneByIp, verifyEmail
$client->networkEngineering getAsnInfoFull, getReceivingFrom, getTransitTo, getBgpPrefixes, getNetworksByCidr, getAsnRankList, getTorExitNodes

Phone Validation

Both methods require explicit country context — never uses server IP silently:

// You know the country
$phone = $client->verification->validatePhone('+61412345678', 'AU');

// You know the end user's IP (pass their IP, not your server's)
$phone = $client->verification->validatePhoneByIp('0412345678', $userIp);

Error Handling

use BigDataCloud\BigDataCloudException;

try {
    $geo = $client->ipGeolocation->get('1.1.1.1');
} catch (BigDataCloudException $e) {
    echo "API error {$e->statusCode}: {$e->getMessage()}\n";
}

Samples

export BIGDATACLOUD_API_KEY=your-key-here
php samples/ip_geolocation.php
php samples/reverse_geocoding.php
php samples/verification.php
php samples/network_engineering.php

Requirements

  • PHP 8.1+
  • ext-curl
  • ext-json

License

MIT — see LICENSE.

bigdatacloudapi/bigdatacloud 适用场景与选型建议

bigdatacloudapi/bigdatacloud 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 bigdatacloudapi/bigdatacloud 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-11