Download the PHP package beziworld/laravel-gus-bdl without Composer

On this page you can find all versions of the php package beziworld/laravel-gus-bdl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-gus-bdl

Laravel GUS BDL

tests Latest Version

Laravel client for the Local Data Bank API of Statistics Poland (GUS, Bank Danych Lokalnych, BDL): the largest Polish database of economic, social and environmental statistics for Poland, voivodeships, counties, communes and statistical localities, from 1995 onwards.

Polska wersja dokumentacji

Why this package

At the time of writing Packagist has no package for the BDL API (searches for "bdl gus" and "bank danych lokalnych" return nothing; the GUS packages that exist cover the REGON registry). Clients exist for Python, R and C#, none for PHP. This package adds a typed, cached and quota-aware Laravel client.

Installation

Everything works anonymously. Optional .env settings:

Subjects and variables

Territorial units and TERYT codes

A BDL unit id has twelve digits: macroregion, voivodeship, region, subregion, county, commune and commune type. The voivodeship, county, commune and type parts are the TERC code, so terytCode() works offline. For the reverse direction unitByTeryt() walks down the hierarchy (three small cached requests at most). To keep a local copy of the TERYT register itself, see laravel-teryt.

Data

Every DataPoint has year, value and attributeId. Attribute 1 marks a regular value; other attributes describe missing, confidential, estimated or incomplete values, which the API still returns (usually as 0). Read their meaning from GusBdl::attributes() (symbol x, a, s, M, ...). aggregateId selects another aggregation (see GusBdl::aggregates()).

Dictionaries, languages and formats

Quotas, rate limiting and caching

The documented quotas are:

Window Anonymous With X-ClientId
1 second 5 10
15 minutes 100 500
12 hours 1 000 5 000
7 days 10 000 50 000

The client counts requests in these windows in a cache store before sending them. When the per-second window is full it waits (up to GUS_BDL_RATE_LIMIT_MAX_WAIT seconds); when a longer window is full it throws RateLimitExceeded with retryAfter instead of spending the remaining budget. Use a shared store (Redis, database) so that queue workers and web requests count together. The API may enforce lower anonymous quotas than documented (its HTTP 429 messages have mentioned 50 requests per 15 minutes and 100 per 12 hours); stricter values can be set in config/gus-bdl.php under rate_limit.limits, and registering a free key is the practical fix.

On HTTP 429 the client reads Retry-After (sent as "340 sek"), throws RateLimitExceeded and refuses further requests locally until the block expires, so a loop does not keep hammering the API.

Responses are cached. A cached response is served without any request while it is fresh (the API sends max-age=1800; override with GUS_BDL_CACHE_TTL). Afterwards it is revalidated with If-None-Match; on 304 Not Modified the cached body is reused. Dictionaries change rarely, so a long TTL is safe for them.

Artisan

Errors

Situation Result
HTTP 404 (unknown id), unknown TERYT code NotFound (httpStatus, path, errorCode)
HTTP 429 from the API RateLimitExceeded (retryAfter, window, fromServer = true)
Local quota exhausted or server block still active RateLimitExceeded (fromServer = false for a local quota)
HTTP 4xx (for example 412 for page size above 100), HTTP 5xx after retries ApiException (httpStatus, errorCode, isServerError())
Connection failure or timeout after retries ApiException wrapping the ConnectionException
Body that is not JSON ApiException
Invalid configuration (GUS_BDL_LANG, page size, URL, limits) InvalidConfiguration
Empty search phrase, invalid TERYT code length, no variable ids InvalidArgumentException

All package exceptions extend Beziworld\GusBdl\Exceptions\GusBdlException.

Development

Tests use responses captured from the live API (tests/Fixtures); no request leaves the test suite.

Author

Created and maintained by Kamil Ćwiertnia, beziworld.eu.

Need an integration? Get in touch through beziworld.eu.

Other packages by the author

laravel-teryt · laravel-krs · laravel-company-data · laravel-nbp

License

MIT. See LICENSE.md. The data is published by Statistics Poland (Główny Urząd Statystyczny) under the Creative Commons Attribution 4.0 licence; credit GUS as the source when you republish it. This package is not affiliated with or endorsed by Statistics Poland.


All versions of laravel-gus-bdl with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-json Version *
guzzlehttp/guzzle Version ^7.8
illuminate/cache Version ^12.0|^13.0
illuminate/console Version ^12.0|^13.0
illuminate/contracts Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package beziworld/laravel-gus-bdl contains the following files

Loading the files please wait ...