gusapi / gusapi
Gus Api Library for PHP
Installs: 968 448
Dependents: 9
Suggesters: 0
Security: 0
Stars: 116
Watchers: 19
Forks: 37
Open Issues: 30
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.11
- phpstan/phpstan: ^1.8
- phpstan/phpstan-phpunit: ^1.1
- phpunit/phpunit: ^9.0
- rector/rector: ^0.14.6
- squizlabs/php_codesniffer: ^3.7
README
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
If you still use PHP <= 8.0 see documentation for 5.x version HERE
Upgrade from 5.x to 6.x
For more information see UPGRADE.md.
Example for 6.x
See file examples/readmeExample.php.
require_once '../vendor/autoload.php'; use GusApi\Exception\InvalidUserKeyException; use GusApi\Exception\NotFoundException; use GusApi\GusApi; use GusApi\ReportTypes; use GusApi\BulkReportTypes; $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); var_dump($gus->dataStatus()); var_dump($gus->getBulkReport( new DateTimeImmutable('2019-05-31'), BulkReportTypes::REPORT_DELETED_LOCAL_UNITS )); foreach ($gusReports as $gusReport) { //you can change report type to other one $reportType = ReportTypes::REPORT_PERSON; echo $gusReport->getName(); echo 'Address: ' . $gusReport->getStreet() . ' ' . $gusReport->getPropertyNumber() . '/' . $gusReport->getApartmentNumber(); $fullReport = $gus->getFullReport($gusReport, $reportType); var_dump($fullReport); } } catch (InvalidUserKeyException $e) { echo 'Bad user key'; } catch (NotFoundException $e) { echo 'No data found <br>'; echo 'For more information read server message below: <br>'; echo sprintf( "StatusSesji:%s\nKomunikatKod:%s\nKomunikatTresc:%s\n", $gus->getSessionStatus(), $gus->getMessageCode(), $gus->getMessage() ); }
Donation
If this project help you reduce time to develop, you can give me a cup of coffee ;)
PayPal Donate