定制 api-check/php-laravel-client 二次开发

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

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

api-check/php-laravel-client

Composer 安装命令:

composer require api-check/php-laravel-client

包简介

ApiCheck wrapper for Laravel - address validation, search, and verification

README 文档

README

A thin Laravel wrapper for the ApiCheck PHP Client.

ApiCheck helps you validate customer data - addresses, emails, and phone numbers.

Requirements

  • PHP 8.1+
  • Laravel 9.0+ | 10.0+ | 11.0+
  • An ApiCheck API key (get one here)

Installation

composer require api-check/php-laravel-client

The service provider and facade are auto-discovered by Laravel.

Configuration

Publish the config file:

php artisan vendor:publish --tag=apicheck-config

Add to your .env:

APICHECK_API_KEY=your-api-key-here

# Optional - required if your API key has "Allowed Hosts" configured
APICHECK_REFERER=https://yourdomain.com

Usage

Via Facade

use ApiCheck\Laravel\Facades\ApiCheck;

// Lookup an address (NL, LU)
$address = ApiCheck::lookup('nl', [
    'postalcode' => '2513AA',
    'number' => 1,
]);

// Get available number additions
$additions = ApiCheck::getNumberAdditions('nl', '2513AA', 1);

// Search for addresses (18 European countries)
$results = ApiCheck::search('be', 'city', ['name' => 'Brussels']);

// Global search
$results = ApiCheck::globalSearch('nl', 'amsterdam', ['limit' => 10]);

// Verify email
$emailResult = ApiCheck::verifyEmail('test@example.com');
// Returns: disposable_email (bool), greylisted (bool), status ("valid"|"invalid"|"unknown")

// Verify phone
$phoneResult = ApiCheck::verifyPhone('+31612345678');
// Returns: valid (bool), country_code, area_code, international_formatted, etc.

Via Helper Function

$address = apicheck()->lookup('nl', ['postalcode' => '2513AA', 'number' => 1]);

Via Dependency Injection

use ApiCheck\Api\ApiClient;

public function __construct(ApiClient $apiCheck)
{
    $this->apiCheck = $apiCheck;
}

public function index()
{
    $address = $this->apiCheck->lookup('nl', ['postalcode' => '2513AA', 'number' => 1]);
}

Available Methods

All methods from api-check/php-client are available:

Lookup API (NL, LU)

  • lookup($country, $query) - Look up address by postal code + house number
  • getNumberAdditions($country, $postalcode, $number) - Get available number additions (e.g., "A", "1-3")

Search API (18 European countries)

  • search($country, $type, $query) - Search by type: city, street, postalcode, address, locality, municipality
  • globalSearch($country, $query, $options) - Global search across all scopes
  • searchLocality($country, $name, $options) - Search localities (deelgemeenten, primarily BE)
  • searchMunicipality($country, $name, $options) - Search municipalities (gemeenten, primarily BE)
  • searchAddress($country, $params) - Resolve full address from IDs returned by other searches
  • getSupportedSearchCountries() - List supported countries

Verify API

  • verifyEmail($email) - Validate email address (disposable, greylisted, valid/invalid/unknown)
  • verifyPhone($number) - Validate phone number with formatting and type info

Supported Countries

Lookup API

  • Netherlands (nl)
  • Luxembourg (lu)

Search & Verify APIs

18 European countries: nl, be, lu, fr, de, cz, fi, it, no, pl, pt, ro, es, ch, at, dk, gb, se

Exception Handling

use ApiCheck\Api\Exceptions\NotFoundException;
use ApiCheck\Api\Exceptions\ValidationException;
use ApiCheck\Api\Exceptions\UnsupportedCountryException;
use ApiCheck\Api\Exceptions\ApiException;

try {
    $address = ApiCheck::lookup('nl', ['postalcode' => '2513AA', 'number' => 1]);
} catch (NotFoundException $e) {
    // No results found
} catch (ValidationException $e) {
    // Invalid input
} catch (UnsupportedCountryException $e) {
    // Country not supported for this endpoint
} catch (ApiException $e) {
    // General API error
}

License

MIT

Support

api-check/php-laravel-client 适用场景与选型建议

api-check/php-laravel-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 10 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-09