ekstro / GusApi

PHP GUS API library based on official REGON SOAP api.

Home Page:https://github.com/johnzuk/GusApi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

Installation

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 UPGRADE.md.

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
    $gus->login();

    $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);
        var_dump($fullReport);
    }
} 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();
}

About

PHP GUS API library based on official REGON SOAP api.

https://github.com/johnzuk/GusApi

License:GNU Lesser General Public License v2.1


Languages

Language:PHP 100.0%