aade/afm-lookup
Composer 安装命令:
composer require aade/afm-lookup
包简介
PHP client for querying Greek VAT/AFM numbers via AADE's official SOAP service
README 文档
README
PHP library for querying Greek VAT (AFM) numbers via AADE's official SOAP service.
Quick Start
composer require aade/afm-lookup
use Aade\AfmLookup\AadeClient; $client = new AadeClient('your_username', 'your_password'); $response = $client->getVatInfo('094014201'); if ($response->success) { echo $response->basic->name; // Business name echo $response->basic->afm; // VAT number echo $response->basic->isActive; // true/false }
Note: You need AADE credentials. Register here.
Table of Contents
Requirements
| Requirement | Version |
|---|---|
| PHP | >= 8.1 |
| ext-soap | * |
| ext-dom | * |
Installation
composer require aade/afm-lookup
Usage Guide
Creating a Client
Basic:
use Aade\AfmLookup\AadeClient; $client = new AadeClient('your_username', 'your_password');
With options:
$client = new AadeClient( username: 'your_username', password: 'your_password', callerAfm: '123456789', // Your AFM (for AADE logging) timeout: 60, // Seconds (default: 30) verifySsl: true, // Default: true );
Looking Up an AFM
$response = $client->getVatInfo('094014201'); if ($response->success) { $info = $response->basic; // Business identity echo $info->afm; // "094014201" echo $info->name; // "ΔΗΜΟΣΙΑ ΕΠΙΧΕΙΡΗΣΗ ΗΛΕΚΤΡΙΣΜΟΥ Α.Ε." echo $info->commercialTitle; // "ΔΕΗ Α.Ε." // Tax office echo $info->doyCode; // "1159" echo $info->doyDescription; // "Φ.Α.Ε. ΑΘΗΝΩΝ" // Address echo $info->postalAddress; // "ΧΑΛΚΟΚΟΝΔΥΛΗ" echo $info->postalAddressNumber; // "30" echo $info->postalZipCode; // "10432" echo $info->postalCity; // "ΑΘΗΝΑ" // Status echo $info->isActive; // true echo $info->isNormalVat; // true echo $info->legalStatusDescription; // "ΑΕ" // Dates (DateTimeImmutable or null) echo $info->registrationDate?->format('d/m/Y'); // "01/01/1950" echo $info->stopDate; // null (if active) }
Validating AFM Format
Validate locally before making an API call:
use Aade\AfmLookup\AadeClient; // Static method - no API call if (AadeClient::validateAfm('094014201')) { // Valid format (9 digits, correct check digit) } // Invalid examples: AadeClient::validateAfm('12345678'); // false - only 8 digits AadeClient::validateAfm('000000000'); // false - all zeros AadeClient::validateAfm('094014202'); // false - wrong check digit
Historical Lookups
Query business information as it was on a specific date:
use DateTimeImmutable; // Get info as of January 15, 2023 $date = new DateTimeImmutable('2023-01-15'); $response = $client->getVatInfo('094014201', $date);
Date format: The library accepts any
DateTimeInterfaceimplementation. Internally, dates are sent to AADE inY-m-dformat (e.g.,2023-01-15).
Business Activities
Each business can have multiple registered activities (KAD codes):
$response = $client->getVatInfo('094014201'); // Get main activity $main = $response->getMainActivity(); if ($main !== null) { echo $main->code; // "35.11" echo $main->description; // "Παραγωγή ηλεκτρικής ενέργειας" } // Iterate all activities foreach ($response->firmActivities as $activity) { echo $activity->code; // KAD code echo $activity->description; // Activity description echo $activity->kind; // 1 = main, 2+ = secondary echo $activity->kindDescription; // "ΚΥΡΙΑ" or "ΔΕΥΤΕΡΕΥΟΥΣΑ" echo $activity->isMainActivity(); // true/false }
Error Handling
use Aade\AfmLookup\AadeClient; use Aade\AfmLookup\Exception\InvalidAfmException; use Aade\AfmLookup\Exception\AuthenticationException; use Aade\AfmLookup\Exception\RateLimitException; use Aade\AfmLookup\Exception\SoapException; use Aade\AfmLookup\Exception\AadeException; try { $response = $client->getVatInfo('094014201'); } catch (InvalidAfmException $e) { // AFM format is invalid (checked locally before API call) } catch (AuthenticationException $e) { // Wrong username/password or account not authorized } catch (RateLimitException $e) { // Daily call limit exceeded } catch (SoapException $e) { // Network error or SOAP fault } catch (AadeException $e) { // Other AADE service errors $errorCode = $e->getErrorCode(); // ErrorCode enum or null }
Checking error types via ErrorCode:
if ($e->getErrorCode()?->isAuthenticationError()) { /* ... */ } if ($e->getErrorCode()?->isRateLimitError()) { /* ... */ } if ($e->getErrorCode()?->isNotFoundError()) { /* ... */ } if ($e->getErrorCode()?->isBlockedError()) { /* ... */ }
API Reference
AadeClient
public function __construct( string $username, string $password, ?string $callerAfm = null, int $timeout = 30, bool $verifySsl = true, )
| Method | Returns | Description |
|---|---|---|
getVatInfo(string $afm, ?DateTimeInterface $asOnDate = null) |
AfmInfoResponse |
Query AFM information |
getVersion() |
string |
Get AADE service version |
validateAfm(string $afm) |
bool |
Validate AFM format (static) |
Response Objects
AfmInfoResponse
| Property | Type | Description |
|---|---|---|
success |
bool |
true if lookup succeeded |
callSequenceId |
?string |
AADE call tracking ID |
basic |
?BasicInfo |
Business information |
firmActivities |
FirmActivity[] |
List of activities |
error |
?ErrorInfo |
Error details (if failed) |
| Method | Returns | Description |
|---|---|---|
getMainActivity() |
?FirmActivity |
Get primary business activity |
BasicInfo
| Property | Type | Description |
|---|---|---|
afm |
?string |
VAT number |
name |
?string |
Legal business name |
commercialTitle |
?string |
Commercial/trade name |
doyCode |
?string |
Tax office code |
doyDescription |
?string |
Tax office name |
legalStatusCode |
?string |
Legal form code |
legalStatusDescription |
?string |
Legal form (ΑΕ, ΕΠΕ, etc.) |
postalAddress |
?string |
Street name |
postalAddressNumber |
?string |
Street number |
postalZipCode |
?string |
Postal code |
postalCity |
?string |
City |
registrationDate |
?DateTimeImmutable |
Registration date |
stopDate |
?DateTimeImmutable |
Deactivation date |
isNormalVat |
bool |
Normal VAT regime |
isActive |
bool |
Currently active |
FirmActivity
| Property | Type | Description |
|---|---|---|
code |
?string |
KAD activity code |
description |
?string |
Activity description |
kind |
?int |
1 = main, 2+ = secondary |
kindDescription |
?string |
Kind label |
| Method | Returns | Description |
|---|---|---|
isMainActivity() |
bool |
Check if primary activity |
ErrorInfo
| Property | Type | Description |
|---|---|---|
code |
?ErrorCode |
Error code enum |
description |
?string |
Error message from AADE |
AADE Error Codes
| Code | Description | Exception Type |
|---|---|---|
RG_WS_PUBLIC_TOKEN_USERNAME_NOT_AUTHENTICATED |
Invalid credentials | AuthenticationException |
RG_WS_PUBLIC_TOKEN_USERNAME_NOT_DEFINED |
Username missing | AuthenticationException |
RG_WS_PUBLIC_TOKEN_USERNAME_NOT_ACTIVE |
Account inactive | AuthenticationException |
RG_WS_PUBLIC_TOKEN_AFM_NOT_AUTHORIZED |
AFM not authorized | AuthenticationException |
RG_WS_PUBLIC_MAX_DAILY_CALLS_EXCEEDED |
Daily limit reached | RateLimitException |
RG_WS_PUBLIC_MAX_DAILY_USERNAME_CALLS_EXCEEDED |
User daily limit | RateLimitException |
RG_WS_PUBLIC_EPIT_NF |
AFM not found | AadeException |
RG_WS_PUBLIC_WRONG_AFM |
Invalid AFM | InvalidAfmException |
RG_WS_PUBLIC_AFM_CALLED_BY_BLOCKED |
Caller AFM blocked | AadeException |
RG_WS_PUBLIC_SERVICE_NOT_ACTIVE |
Service unavailable | AadeException |
See ErrorCode.php for the complete list.
License
MIT License. See LICENSE for details.
aade/afm-lookup 适用场景与选型建议
aade/afm-lookup 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「soap」 「vat」 「tax」 「afm」 「greece」 「aade」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 aade/afm-lookup 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aade/afm-lookup 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 aade/afm-lookup 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
cURL and cURL based Soap-Client for PHP
A PHP client for the Salesforce SOAP API
A VAT number check (Web Service) Plugin for CakePHP
API client for validating Tax Identification Number.
Validate the format of EU vat numbers.
Module allowing creation of tax rates and categories in the CMS via SiteConfig
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-17