PHPackages                             ready-dev-team/nbp-web-api - 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. ready-dev-team/nbp-web-api

ActiveLibrary[API Development](/categories/api)

ready-dev-team/nbp-web-api
==========================

NBP Web API client for PHP.

2.0.0(1y ago)01.6k↑46.4%MITPHPPHP 8.0.\* || 8.1.\* || 8.2.\* || 8.3.\*

Since Feb 14Pushed 1y agoCompare

[ Source](https://github.com/ready-dev-team/nbp-web-api-php)[ Packagist](https://packagist.org/packages/ready-dev-team/nbp-web-api)[ RSS](/packages/ready-dev-team-nbp-web-api/feed)WikiDiscussions main Synced yesterday

READMEChangelog (3)Dependencies (19)Versions (4)Used By (0)

NBP Web API Client
==================

[](#nbp-web-api-client)

[![Latest Stable Version](https://camo.githubusercontent.com/ca73a0c272fe311f23ee0c30dbd99848156d1e17d8fb1fe70213239eedc1cf67/68747470733a2f2f706f7365722e707567782e6f72672f6b726579752f6e62702d7765622d6170692f76657273696f6e)](https://packagist.org/packages/kreyu/nbp-web-api)[![Build Status](https://camo.githubusercontent.com/75d61116243fec2647165f9e43447892b7ad72b9ae94bacb1437cd56868523d4/68747470733a2f2f6170692e7472617669732d63692e636f6d2f4b726579752f6e62702d7765622d6170692d7068702e737667)](https://travis-ci.org/Kreyu/nbp-web-api-php)

Simple and fluent interface to retrieve data from [NBP Web API](http://api.nbp.pl/).
This library structure is strongly inspired by [knplabs/github-api](https://github.com/KnpLabs/php-github-api) package.

### Installation

[](#installation)

This package is decoupled from any HTTP client thanks to the [HTTPlug](https://httplug.io/).
Requires packages that provide [http-client-implementation](https://packagist.org/providers/psr/http-client-implementation) and [psr/http-factory-implementation](https://packagist.org/providers/psr/http-factory-implementation).
For more information visit [HTTPlug for library users](https://docs.php-http.org/en/latest/httplug/users.html).

```
$ composer require kreyu/nbp-web-api

```

### Usage

[](#usage)

```
use Kreyu\NBPWebApi\Client;
use Kreyu\NBPWebApi\Api\ExchangeRates;

$client = new Client();

// Example call
$client->exchangeRates(ExchangeRates::TABLE_TYPE_A)->forCurrency('EUR')->latest(5);
```

#### Changing content type

[](#changing-content-type)

If you wish to retrieve responses in XML format rather than JSON, you can change it in the client:

```
use Kreyu\NBPWebApi\Client;
use Kreyu\NBPWebApi\ClientInterface;

$client = new Client();
$client->setContentType(ClientInterface::CONTENT_TYPE_XML);
```

#### Providing HTTP client and factories

[](#providing-http-client-and-factories)

By default, the HTTP client builder uses HTTP client and factories provided by the [discovery](https://github.com/php-http/discovery).
If you have to provide specific [PSR-18](https://www.php-fig.org/psr/psr-18/) compliant client or any [PSR-17](https://www.php-fig.org/psr/psr-17/) factory, you can pass them to the HTTP client builder:

```
use Kreyu\NBPWebApi\Client;
use Kreyu\NBPWebApi\Http\ClientBuilder as HttpClientBuilder;

/**
 * @var $client         Psr\Http\Client\ClientInterface
 * @var $requestFactory Psr\Http\Message\RequestFactoryInterface
 * @var $streamFactory  Psr\Http\Message\StreamFactoryInterface
 * @var $uriFactory     Psr\Http\Message\UriFactoryInterface
 */

$builder = new HttpClientBuilder(
    $client,
    $requestFactory,
    $streamFactory,
    $uriFactory
);

$client = new Client($builder);
```

#### Caching

[](#caching)

To use caching mechanism, provide any [PSR-6](https://www.php-fig.org/psr/psr-6/) compliant item pool to the HTTP client builder:

```
use Kreyu\NBPWebApi\Client;
use Kreyu\NBPWebApi\Http\ClientBuilder as HttpClientBuilder;

/** @var $pool Psr\Cache\CacheItemPoolInterface */

$builder = new HttpClientBuilder();
$builder->setCache($pool);

$client = new Client($builder);
```

#### Using HTTPlug plugins

[](#using-httplug-plugins)

You can provide any [HTTPlug plugin](http://docs.php-http.org/en/latest/plugins/) to the HTTP client builder:

```
use Kreyu\NBPWebApi\Client;
use Kreyu\NBPWebApi\Http\ClientBuilder as HttpClientBuilder;

/** @var $plugin Http\Client\Common\Plugin */

$builder = new HttpClientBuilder();
$builder->addPlugin($plugin);

$client = new Client($builder);
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance44

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~31 days

Total

3

Last Release

442d ago

Major Versions

1.0.1 → 2.0.02025-04-17

PHP version history (3 changes)1.0.0PHP ^7.2 || ^8.0

1.0.1PHP 8.0.\* || 8.1.\* || 8.2.\*

2.0.0PHP 8.0.\* || 8.1.\* || 8.2.\* || 8.3.\*

### Community

Maintainers

![](https://www.gravatar.com/avatar/d9f22e9ac5d997147e5e9c856adc03d85b1ee23eaf1ee9301ffb5d7fa12bbfe3?d=identicon)[ready.dev.team](/maintainers/ready.dev.team)

---

Top Contributors

[![Kreyu](https://avatars.githubusercontent.com/u/24738141?v=4)](https://github.com/Kreyu "Kreyu (20 commits)")[![Tomasz-Symfonia](https://avatars.githubusercontent.com/u/250133364?v=4)](https://github.com/Tomasz-Symfonia "Tomasz-Symfonia (3 commits)")[![ready-dev-team](https://avatars.githubusercontent.com/u/199053902?v=4)](https://github.com/ready-dev-team "ready-dev-team (2 commits)")

---

Tags

apiclientnbp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ready-dev-team-nbp-web-api/health.svg)

```
[![Health](https://phpackages.com/badges/ready-dev-team-nbp-web-api/health.svg)](https://phpackages.com/packages/ready-dev-team-nbp-web-api)
```

###  Alternatives

[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k28.0M317](/packages/openai-php-client)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M736](/packages/sylius-sylius)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28150.5k](/packages/phpro-http-tools)[m4tthumphrey/php-gitlab-api

GitLab API v4 client for PHP

9515.8M76](/packages/m4tthumphrey-php-gitlab-api)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

1003.9M50](/packages/getbrevo-brevo-php)

PHPackages © 2026

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