marios88 / php-gsis
Helper Classes for consuming Greek GSIS services
Requires
- php: ^8.2
- ext-soap: *
Requires (Dev)
- phpunit/phpunit: ^11.5 || ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-26 20:45:13 UTC
README
A collection of classes for painless consuming of various GSIS SOAP services.
\Gsis\VatDetails for requesting VAT information (RgWsPublic / RgWsPublic2 services)
\Gsis\Article39a for getting the compliance status for Article 39a (Άρθρο 39α)
Installation
- Minimum PHP 8.2
- Requires the SOAP extension to be already installed
- Install Composer.
- Then install using the following command:
composer require marios88/php-gsis
Configuration
You are required to register with Gsis before using most of their services.
Note that 39a and Vat details require different credentials ( how to create them (Greek) )
Examples
<?php use Gsis\Article39a; use Gsis\GsisException; use Gsis\VatDetails; require __DIR__.'/vendor/autoload.php'; $gsis = new Article39a('myusername1', 'mypassword1', 'myafm1'); try { var_dump($gsis->fetchBasicRecord('otherafm1')); // supl_afm, buyer_afm, buyer_fullname, buyer_normal_vat_system, ... } catch (GsisException $e) { echo $e->getErrorCode(), ': ', $e->getMessage(); } $gsis = new VatDetails('myusername2', 'mypassword2', 'myafm1'); try { var_dump($gsis->fetchBasicRecord('otherafm2')); // afm, doy_descr, onomasia, normal_vat_system_flag, ... } catch (GsisException $e) { echo $e->getErrorCode(), ': ', $e->getMessage(); }
Each class has two sets of methods:
fetch() / fetchBasic() |
fetchRecord() / fetchBasicRecord() |
|
|---|---|---|
| Behaviour | Same as 0.x | New in 0.3.0 |
| Service errors | Returned in the data (message_code, pErrorRec_out) |
Throw Gsis\GsisException |
VatDetails service |
RgWsPublic, falls back to RgWsPublic2 if it fails | RgWsPublic2 |
VatDetails fields |
RgWsPublic names (RgWsPublicBasicRt_out, postalAddressNo, ...) |
RgWsPublic2 names (basic_rec, postal_address_no, ...) |
GsisException::getErrorCode() returns the GSIS error code, or GsisException::MALFORMED_RESPONSE when the response
is missing the expected records. Network and SOAP level failures throw SoapFault from all methods, as before.
The SOAP clients are created on first use and reused for subsequent calls on the same object.
Proxy
$gsis->setProxy('proxy.example.com', 3128); $gsis->setProxy('proxy.example.com', 3128, 'proxyuser', 'proxypass'); $gsis->clearProxy();
Proxy login and password must be given together. setProxyAddress() / setProxyPort() still work as in 0.x:
the proxy is only used once both are set.
Upgrading from 0.x
Run composer require marios88/php-gsis:^0.3. Code written for 0.x keeps
working unchanged, including subclasses:
a39, fetch(), fetchBasic(), the proxy setters, the $user / $pass / $ownTaxid properties and the method
signatures are all kept.
VatDetails::fetch() / fetchBasic() still call the old RgWsPublic service with the same request, so the answer is
exactly what 0.x returned. RgWsPublic2 is its successor: if RgWsPublic fails or AADE retires it, they answer from RgWsPublic2 instead, mapped to
the same RgWsPublic shape. The mapped answer has trimmed values and registDate / stopDate as plain dates
(YYYY-MM-DD), as RgWsPublic2 returns no time part. Move to fetchBasicRecord() to use RgWsPublic2 directly.
PHP 8.2 or newer is required, on older PHP versions Composer keeps installing 0.2.0.
Testing
composer install
composer test
Release History
- 0.3.0
- PHP 8.2, backwards compatible with 0.2.0 code
VatDetails::fetch()/fetchBasic()fall back to RgWsPublic2, in the old RgWsPublic shape, when RgWsPublic fails- New
fetchRecord()/fetchBasicRecord()on both classes, returning the service records and throwingGsisExceptionon service errors fetchBasic()of 39a fixed for the current response format,Article39ais the new name ofa39setProxy()with optional proxy credentials,clearProxy()- Single SOAP client per object, no extra version call per lookup
- 0.2.0
- PHP 7.4
- Allow setting proxy
- 0.1.0
- Initial Release
Notes
This was inspired by the work of dspinellis/greek-vat-data
Gsis 39a Service
Gsis 39a Service Developer Manual (in greek)
License
MIT