PHPackages                             aade/afm-lookup - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. aade/afm-lookup

ActiveLibrary[HTTP &amp; Networking](/categories/http)

aade/afm-lookup
===============

PHP client for querying Greek VAT/AFM numbers via AADE's official SOAP service

v0.1.1(5mo ago)00MITPHPPHP ^8.1CI failing

Since Jan 17Pushed 5mo agoCompare

[ Source](https://github.com/klipitkas/aade-public-search-afm)[ Packagist](https://packagist.org/packages/aade/afm-lookup)[ RSS](/packages/aade-afm-lookup/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (3)Versions (3)Used By (0)

AADE AFM Lookup
===============

[](#aade-afm-lookup)

PHP library for querying Greek VAT (AFM) numbers via AADE's official SOAP service.

[![PHP Version](https://camo.githubusercontent.com/04744bae0a61d2ffe29c26f07a9612eae20445fc6feaeb77b3af1f0e9be6447c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

---

Quick Start
-----------

[](#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](https://www.aade.gr/epiheiriseis/forologikes-ypiresies/mitroo/anazitisi-basikon-stoiheion-mitrooy-epiheiriseon).

---

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

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Usage Guide](#usage-guide)
    - [Creating a Client](#creating-a-client)
    - [Looking Up an AFM](#looking-up-an-afm)
    - [Validating AFM Format](#validating-afm-format)
    - [Historical Lookups](#historical-lookups)
    - [Business Activities](#business-activities)
- [Error Handling](#error-handling)
- [API Reference](#api-reference)
    - [AadeClient](#aadeclient)
    - [Response Objects](#response-objects)
- [AADE Error Codes](#aade-error-codes)
- [License](#license)

---

Requirements
------------

[](#requirements)

RequirementVersionPHP&gt;= 8.1ext-soap\*ext-dom\*---

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

[](#installation)

```
composer require aade/afm-lookup
```

---

Usage Guide
-----------

[](#usage-guide)

### Creating a Client

[](#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

[](#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

[](#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

[](#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 `DateTimeInterface` implementation. Internally, dates are sent to AADE in `Y-m-d` format (e.g., `2023-01-15`).

### Business Activities

[](#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
--------------

[](#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
-------------

[](#api-reference)

### AadeClient

[](#aadeclient)

```
public function __construct(
    string $username,
    string $password,
    ?string $callerAfm = null,
    int $timeout = 30,
    bool $verifySsl = true,
)
```

MethodReturnsDescription`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

[](#response-objects)

#### AfmInfoResponse

[](#afminforesponse)

PropertyTypeDescription`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)MethodReturnsDescription`getMainActivity()``?FirmActivity`Get primary business activity#### BasicInfo

[](#basicinfo)

PropertyTypeDescription`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

[](#firmactivity)

PropertyTypeDescription`code``?string`KAD activity code`description``?string`Activity description`kind``?int`1 = main, 2+ = secondary`kindDescription``?string`Kind labelMethodReturnsDescription`isMainActivity()``bool`Check if primary activity#### ErrorInfo

[](#errorinfo)

PropertyTypeDescription`code``?ErrorCode`Error code enum`description``?string`Error message from AADE---

AADE Error Codes
----------------

[](#aade-error-codes)

CodeDescriptionException 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`](src/Enum/ErrorCode.php) for the complete list.

---

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance70

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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

Every ~0 days

Total

2

Last Release

167d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3259834?v=4)[Konstantinos Lypitkas](/maintainers/klipitkas)[@klipitkas](https://github.com/klipitkas)

---

Top Contributors

[![klipitkas](https://avatars.githubusercontent.com/u/3259834?v=4)](https://github.com/klipitkas "klipitkas (3 commits)")

---

Tags

aadeafmsoap-clientvatvat-numbervat-validationsoapvatafmtaxaadegreece

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/aade-afm-lookup/health.svg)

```
[![Health](https://phpackages.com/badges/aade-afm-lookup/health.svg)](https://phpackages.com/packages/aade-afm-lookup)
```

###  Alternatives

[econea/nusoap

Fixed NuSOAP for PHP 5.6 - 8.5

3395.8M28](/packages/econea-nusoap)[robrichards/wse-php

Libraries for adding WS-\* support to ext/soap in PHP.

1346.3M33](/packages/robrichards-wse-php)[meng-tian/async-soap-guzzle

An asynchronous SOAP client build on top of Guzzle.

992.5M4](/packages/meng-tian-async-soap-guzzle)[wsdltophp/wssecurity

Allows to easily add Ws Security header to a SOAP Request

42879.9k8](/packages/wsdltophp-wssecurity)[meng-tian/soap-http-binding

A PHP library for binding SOAP messages to PSR-7 HTTP messages.

162.6M4](/packages/meng-tian-soap-http-binding)[clue/soap-react

Simple, async SOAP webservice client library, built on top of ReactPHP

64123.7k2](/packages/clue-soap-react)

PHPackages © 2026

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