PHPackages                             davidvanerkelens/ynab-php-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. davidvanerkelens/ynab-php-client

AbandonedArchivedLibrary[API Development](/categories/api)

davidvanerkelens/ynab-php-client
================================

A PHP client implementation for the You Need A Budget (YNAB) API.

v0.2.2(4y ago)29MITPHP

Since Oct 2Pushed 4y ago2 watchersCompare

[ Source](https://github.com/DavidvanErkelens/ynab-php-client)[ Packagist](https://packagist.org/packages/davidvanerkelens/ynab-php-client)[ RSS](/packages/davidvanerkelens-ynab-php-client/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (13)Versions (5)Used By (0)

PHP client library for YNAB
===========================

[](#php-client-library-for-ynab)

[![build status](https://github.com/DavidvanErkelens/ynab-php-client/actions/workflows/ci.yml/badge.svg)](https://github.com/DavidvanErkelens/ynab-php-client/actions/workflows/ci.yml/badge.svg)[![version](https://camo.githubusercontent.com/d8363f5af9f8f9bddf48854d6a19a3101bcccd103e93f87dfd1c666292f419bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f446176696476616e45726b656c656e732f796e61622d7068702d636c69656e743f736f72743d73656d766572)](https://camo.githubusercontent.com/d8363f5af9f8f9bddf48854d6a19a3101bcccd103e93f87dfd1c666292f419bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f446176696476616e45726b656c656e732f796e61622d7068702d636c69656e743f736f72743d73656d766572)[![release date](https://camo.githubusercontent.com/f92f9a62c5a15fa0f993377aa92b3b03631ffeceef721a1a948d8da8a2cfe264/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f446176696476616e45726b656c656e732f796e61622d7068702d636c69656e74)](https://camo.githubusercontent.com/f92f9a62c5a15fa0f993377aa92b3b03631ffeceef721a1a948d8da8a2cfe264/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f446176696476616e45726b656c656e732f796e61622d7068702d636c69656e74)[![license](https://camo.githubusercontent.com/0ddbd2c4ea08f53c1b072e010cdc2d438436058fc2a7b5efe0a8f5f8c217b01e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f446176696476616e45726b656c656e732f796e61622d7068702d636c69656e74)](https://camo.githubusercontent.com/0ddbd2c4ea08f53c1b072e010cdc2d438436058fc2a7b5efe0a8f5f8c217b01e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f446176696476616e45726b656c656e732f796e61622d7068702d636c69656e74)

This is a PHP client implementation for the *You Need A Budget* (YNAB) API.

⚠️ This library is still in active development. Not all code is covered by tests yet, and contracts are subject to change. Breaking changes will be released according to [semantic versioning](https://github.com/semver/semver) version numbers.

Installation
------------

[](#installation)

### Using composer

[](#using-composer)

```
composer require davidvanerkelens/ynab-php-client

```

### Manual installation

[](#manual-installation)

Download the contents of this repository, and include the `vendor/autoloader.php` file.

Basic usage
-----------

[](#basic-usage)

In order to use this library, you need an API key. See the [YNAB API documentation](https://api.youneedabudget.com/#authentication)for more information about this.

```
// Create a basic configuration
// Returns an instance of ConfigurationInterface
$config = YNAB::createConfiguration('your api token');

// Create a client object
// Returns an instance of ClientInterface
$client = YNAB::createClient($config);
```

Via the `$client` object, all non-deprecated methods available on the YNAB API can be accessed. See [this](docs/client-methods.md)document for all available methods on the client object.

Server knowledge
----------------

[](#server-knowledge)

Several endpoints can be provided with a number, indicating the [last server knowledge state](https://api.youneedabudget.com/#deltas). If available, the server knowledge state is included in the response object.

Error handling
--------------

[](#error-handling)

If a request to the API returns an unexpected status code, a [YnabErrorException](src/Exceptions/YnabErrorException.php)will be thrown. In this exception, an instance of [ErrorResponseInterface](src/Infrastructure/Errors/ErrorResponseInterface.php)can be found, which contains the error reported by the YNAB API.

Milliunits
----------

[](#milliunits)

All amounts reported by the YNAB API are in milliunits format. A converter for this format is available.

```
$converter = YNAB::getMilliunitsConverter();
$converter->toFloat(123930); // returns 123.93
$converter->fromFloat(123.93); // returns 123930
```

Rate limiting
-------------

[](#rate-limiting)

YNAB's API is rate limited to 200 requests per access token per hour. The current usage is returned by the YNAB API in a header, which you can fetch via the client object after a call to the API has been performed.

```
$config = YNAB::createConfiguration('your api token');
$client = YNAB::createClient($config);

// your logic here

$rateLimit = $client->getRateLimit();
```

This function will return `null` if no requests have been made yet. The returned value of this function is the number of requests made towards the rate limit as reported at the moment of the last response from the YNAB API.

Caching
-------

[](#caching)

This library supports caching for all GET requests. By default, a simple in-memory cache will be used with a timeout of 5 minutes. If you want to disable caching, you can do so via the configuration object.

```
$config = YNAB::createConfiguration('your api token');
$config->setCachingDisabled(true);
```

In the same way, you can configure the timeout for the cache.

```
$config = YNAB::createConfiguration('your api token');
$config->setCacheTimeout(new DateInterval("PT10M"));
```

You can also call the `setCacheTimeout` function with `null` to disable expiration of cached items.

It is also possible to provide your own caching adapter that implements the [PSR-6](https://www.php-fig.org/psr/psr-6/)`CacheItemPoolInterface`.

```
$config = YNAB::createConfiguration('your api token');
$config->setCacheItemPool(new MyCache());
```

Contributing
------------

[](#contributing)

This library is still an active work in progress by the author. Pull requests are appreciated, but the library can undergo structural changes at any moment in time.

Authors
-------

[](#authors)

- [DavidvanErkelens](https://github.com/DavidvanErkelens)

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

4

Last Release

1680d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/77f663b530d20f891c3389ea90ff525dd04ae45c480f5537e99c73bb40e0a63b?d=identicon)[DavidvanErkelens](/maintainers/DavidvanErkelens)

---

Top Contributors

[![DavidvanErkelens](https://avatars.githubusercontent.com/u/1162245?v=4)](https://github.com/DavidvanErkelens "DavidvanErkelens (10 commits)")

---

Tags

phpynab

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/davidvanerkelens-ynab-php-client/health.svg)

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M648](/packages/sylius-sylius)[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[googleads/googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP

67410.3M25](/packages/googleads-googleads-php-lib)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[concrete5/core

Concrete core subtree split

19159.3k48](/packages/concrete5-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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