PHPackages                             jpry/ynab-sdk-php - 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. jpry/ynab-sdk-php

ActiveLibrary[API Development](/categories/api)

jpry/ynab-sdk-php
=================

Framework-agnostic YNAB API client for PHP

v2.4.0(4w ago)035[1 issues](https://github.com/JPry/ynab-sdk-php/issues)MITPHPPHP ^8.3CI failing

Since Feb 19Pushed 4w agoCompare

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

READMEChangelog (7)Dependencies (19)Versions (9)Used By (0)

JPry YNAB
=========

[](#jpry-ynab)

Framework-agnostic PHP library for the YNAB API.

Repository: [jpry/ynab-sdk-php](https://github.com/JPry/ynab-sdk-php)

Highlights
----------

[](#highlights)

- Namespace root: `JPry\\YNAB\\`
- Typed resources for users, plans, plan settings, accounts, categories, category groups, payees, payee locations, months, money movements, scheduled transactions, and transactions
- Endpoint-by-name client methods (`user()`, `plans()`, `planSettings()`, `category()`, `monthCategory()`, `months()`, `moneyMovements()`, `scheduledTransactions()`, etc.)
- Structured YNAB errors (`error.id`, `error.name`, `error.detail`)
- Supports API key auth and OAuth token auth
- Uses PSR-7/PSR-18 HTTP contracts; any codebase can provide its own sender by implementing `JPry\\YNAB\\Http\\RequestSender`

Install
-------

[](#install)

```
composer require jpry/ynab-sdk-php
```

If you want the built-in default sender:

```
composer require guzzlehttp/guzzle
```

Quick start
-----------

[](#quick-start)

### API key

[](#api-key)

```
use JPry\YNAB\Client\YnabClient;
use JPry\YNAB\Config\ClientConfig;

$config = new ClientConfig(
    baseUrl: 'https://api.ynab.com/v1',
    timeoutSeconds: 30,
    maxRetries: 2,
);

$client = YnabClient::withApiKey('your-api-key', config: $config);
$user = $client->user();
$plans = $client->plans();
$settings = $client->planSettings('plan-id');
$months = $client->months('plan-id');
$moneyMovements = $client->moneyMovements('plan-id');
$scheduled = $client->scheduledTransactions('plan-id');
$payeeLocations = $client->payeeLocations('plan-id');
$category = $client->category('plan-id', 'category-id');
$monthCategory = $client->monthCategory('plan-id', '2026-03-01', 'category-id');
$transactions = $client->transactions('plan-id', ['since_date' => '2026-01-01']);
```

Legacy budget-named APIs (`budgets()`, `defaultBudget()`, and `JPry\\YNAB\\Model\\Budget`) remain available for backward compatibility but are deprecated and emit `E_USER_DEPRECATED` warnings.

Most mutating methods (create/update/delete) return the raw `data` payload from the API response as `array`. Mutating methods also accept typed request models in `JPry\\YNAB\\Model\\Mutation\\*` (legacy array and string-id signatures remain supported).

```
use JPry\YNAB\Model\Mutation\CreateTransactionsRequest;
use JPry\YNAB\Model\Mutation\TransactionPayload;
use JPry\YNAB\Model\Mutation\UpdateTransactionRequest;

$client->createTransactions(
    'plan-id',
    CreateTransactionsRequest::single(
        new TransactionPayload(accountId: 'account-id', amount: -1000)
    ),
);

$client->updateTransaction(
    'plan-id',
    new UpdateTransactionRequest('transaction-id', new TransactionPayload(memo: 'Updated memo')),
);
```

Documentation
-------------

[](#documentation)

- [Documentation Index](./docs/README.md)
- [Getting Started](./docs/getting-started.md)
- [API Usage](./docs/api-usage.md)
- [Mutations and Request Models](./docs/mutations.md)
- [OAuth Flow](./docs/oauth-flow.md)
- [Migration Notes: Budgets to Plans](./docs/migration-plans.md)
- [OpenAPI Spec Snapshot](./openapi/README.md)

### OAuth token

[](#oauth-token)

```
use JPry\YNAB\Client\YnabClient;
use JPry\YNAB\Config\ClientConfig;

$config = new ClientConfig();
$client = YnabClient::withOAuthToken(
    accessToken: 'access-token',
    refreshAccessToken: fn (): string => 'new-access-token',
    config: $config,
);
```

OAuth flow helper
-----------------

[](#oauth-flow-helper)

```
use JPry\YNAB\Http\GuzzleRequestSender;
use JPry\YNAB\OAuth\OAuthClient;
use JPry\YNAB\OAuth\OAuthConfig;
use JPry\YNAB\Config\ClientConfig;

$oauth = new OAuthClient(
    new OAuthConfig(
        clientId: 'client-id',
        clientSecret: 'client-secret',
        redirectUri: 'https://example.com/oauth/callback',
    ),
    new GuzzleRequestSender(new ClientConfig()),
);

$authUrl = $oauth->authorizationUrl('state-value');
$tokens = $oauth->exchangeCodeForTokens('code-from-callback');
```

Using your own HTTP client
--------------------------

[](#using-your-own-http-client)

```
use JPry\YNAB\Http\RequestSender;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Psr7\Response;

final class MySender implements RequestSender
{
    public function sendRequest(RequestInterface $request): ResponseInterface
    {
        // Bridge to your own HTTP library
        return new Response(200, [], '{"data":{}}');
    }
}
```

Then pass it into factory methods:

```
$client = YnabClient::withApiKey('api-key', requestSender: new MySender());
```

Pagination
----------

[](#pagination)

Collection methods automatically follow pagination metadata when present (`next_page`, `next_page_url`, or `links.next`).

OpenAPI spec
------------

[](#openapi-spec)

The repository includes a local snapshot of the YNAB OpenAPI specification at `openapi/ynab-v1.openapi.yaml`.

- Sync manually: `./scripts/sync-openapi-spec.sh`
- Automated sync: `.github/workflows/openapi-spec-sync.yml` (weekly + manual dispatch)

Tests
-----

[](#tests)

```
composer test
```

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance91

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

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 ~17 days

Total

7

Last Release

28d ago

Major Versions

v1.1.0 → v2.0.02026-03-17

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/871924?v=4)[Jeremy Pry](/maintainers/JPry)[@JPry](https://github.com/JPry)

---

Top Contributors

[![JPry](https://avatars.githubusercontent.com/u/871924?v=4)](https://github.com/JPry "JPry (100 commits)")

---

Tags

phpapiclientlaravelynab

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/jpry-ynab-sdk-php/health.svg)

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[openai-php/client

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

5.8k28.0M318](/packages/openai-php-client)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[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)[sylius/sylius

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

8.5k5.9M737](/packages/sylius-sylius)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.7k409.0k6](/packages/theodo-group-llphant)

PHPackages © 2026

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