PHP GUS API library based on official REGON SOAP api.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

PHP GUS API library

Packagist Build Status Codecov Packagist Packagist StyleCI Scrutinizer Code Quality

PHP GUS API is an object-oriented library to get information from REGON site based on official REGON SOAP API. Official GUS docs here.


This library uses Composer, just type in:

composer require gusapi/gusapi

Supported Versions

Version PHP version Support Doc
4.x >= 7.1 Support ends on December 1, 2019 Doc
3.3.x >= 5.6 Support ends on December 1, 2018 Doc
3.2.x >= 5.4 Support ended on April 1, 2018 Doc

If you use PHP <= 7.0 see documentation for 3.3.x version HERE

Upgrade from 3.x to 4.x

For more information see

Example for 4.x

See file examples/readmeExample.php.

require_once '../vendor/autoload.php';

use GusApi\Exception\InvalidUserKeyException;
use GusApi\GusApi;
use GusApi\ReportTypes;

$gus = new GusApi('your api key here');
//for development server use:
//$gus = new GusApi('abcde12345abcde12345', 'dev');

try {
    $nipToCheck = 'xxxxxxxxxx'; //change to valid nip value

    $gusReports = $gus->getByNip($nipToCheck);

    foreach ($gusReports as $gusReport) {
        //you can change report type to other one
        $reportType = ReportTypes::REPORT_PUBLIC_LAW;
        echo $gusReport->getName();
        $fullReport = $gus->getFullReport($gusReport, $reportType);
} catch (InvalidUserKeyException $e) {
    echo 'Bad user key';
} catch (\GusApi\Exception\NotFoundException $e) {
    echo 'No data found <br>';
    echo 'For more information read server message below: <br>';
    echo $gus->getResultSearchMessage();