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
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
For more information see UPGRADE.md.
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();
}
If this project help you reduce time to develop, you can give me a cup of coffee ;)
PayPal Donate