PHPackages                             digital-holding/php-gus-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. digital-holding/php-gus-client

ActiveLibrary[API Development](/categories/api)

digital-holding/php-gus-client
==============================

PHP Client library for Główny Urząd Statystyczny (Polish Central Statistical Office, known also as "Statistics Poland").

25.9k↓33.3%1PHP

Since Jun 29Pushed 5y ago6 watchersCompare

[ Source](https://github.com/Digital-Holding/php-gus-client)[ Packagist](https://packagist.org/packages/digital-holding/php-gus-client)[ RSS](/packages/digital-holding-php-gus-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-gus-client
==============

[](#php-gus-client)

PHP Client library for Główny Urząd Statystyczny (Polish Central Statistical Office, known also as "Statistics Poland").

[![Tests status](https://github.com/Digital-Holding/php-gus-client/workflows/Build/badge.svg)](https://github.com/Digital-Holding/php-gus-client/workflows/Build/badge.svg) [![Coverage Status](https://camo.githubusercontent.com/5343555c247dab587e30f463293185c37da4a9e287b58b645f8b41a81019e041/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4469676974616c2d486f6c64696e672f7068702d6775732d636c69656e742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Digital-Holding/php-gus-client?branch=master)

Allows (fairly) easy interaction with the webservices of GUS which are described in detailed on their websites:

Installation
============

[](#installation)

It is suggested to use `composer` in your project which allows automatic installation, to do so use:

```
composer require dh/php-gus-client

```

Yet you can of course still manually include **all** of the files in your project (that is why composer is suggested as it automatically autoloads all required classes).

Installation in Symfony
=======================

[](#installation-in-symfony)

Thanks to the provided factories it is possible to use the library easily with Symfony 4+, just add to your `services.yaml`:

```
    dh.service.gusclient:
        factory: ['DH\GUS\GUSClientFactory', 'createWithEnvironment']
        class: DH\GUS\GUSClient
        arguments:
            - 'production'
            - 'your login key'
```

Where first argument must be `production` or `test`. For `production` you need to provide your **login key** obtained from GUS as the second argument.

For `test` environment no additional arguments are required as default login key for testing purposes is used.

Supported operations
====================

[](#supported-operations)

Login
-----

[](#login)

```
$client->login();
```

Attempts to sign in using your login key. Most other methods require you to be signed in.

Logout
------

[](#logout)

```
$client->logout();
```

Destroys your previously created session.

Retrieve companies' details
---------------------------

[](#retrieve-companies-details)

```
$client->getCompanyDetails(CompanyIdType::NIP, ['7740001454', '7642542255']);
```

Where first argument defined the identifier type and second argument should be a string or an array of up to 20 strings which are values of the selected identifier type.

Method returns **always** an **array** of `CompanyDetails` instances by their **NIP** identifiers.

Retrieve last error
-------------------

[](#retrieve-last-error)

In case of an error method `getLastError` returns its description (in Polish). \*\*May be empty even if an error occurred in the `test` environment.

Retrieve Full report
--------------------

[](#retrieve-full-report)

```
$client->getFulLReport('BIR11OsFizycznaDaneOgolne', $companyDetails['7642542255']);
```

Retrieves a full report in a form of an array for the given `CompanyDetails`.

**Warning:** library does not expose a way to retrieve a report by NIP, REGON or KRS because it verifies first if provided `CompanyDetails` are compatbile with the provided report type in terms of supported `type` and `silo id`.

Full list of returned fields for each report type can be found in the folder `BIR11_StrukturyDanych` of the documentation on GUS' website.

First argument must be a name of supported report type. Supported report types are defined in `DH\GUS\Model\ReportType` namespace.

TODO
====

[](#todo)

- method to retrieve all supported report types
- supported report types by `CompanyDetails`
- implementation of the `DanePobierzRaportZbiorczy` call
- service status call implementation
- automatic login if session was expired
- session re-use (session adapter)
- phpDocs
- improved unit tests

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a34608c32c447f48f1a8d08aedc1be39ac565ead4f4ff55c08442b357cd80c97?d=identicon)[digitalholding](/maintainers/digitalholding)

### Embed Badge

![Health badge](/badges/digital-holding-php-gus-client/health.svg)

```
[![Health](https://phpackages.com/badges/digital-holding-php-gus-client/health.svg)](https://phpackages.com/packages/digital-holding-php-gus-client)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
