Repository navigation
v2.0.0
Overview
v2.0.0 is a major release aligned with the YNAB API v1.79.0 migration from budget terminology to plan terminology. It substantially expands endpoint coverage, adds write support across all major resources, improves type safety in mutation models, and hardens security across the auth layer.
Breaking Changes
API path migration: budgets → plans
All client requests now use /plans/{plan_id}/... paths to match YNAB API v1.79.0. The budgets(), defaultBudget(), and Budget model have been removed entirely.
The $budgetId parameter has been renamed to $planId across all YnabClient methods.
Migration: Replace
$client->budgets()with$client->plans(),$client->defaultBudget()with$client->defaultPlan(), update$budgetIdnamed arguments to$planId, and replace anyBudgettype references withPlan.
Mutation model fields now use enums
The following string fields in mutation request models have been replaced with typed PHP 8.1 enums:
| Model | Property | Old type | New type |
|---|---|---|---|
TransactionPayload |
$cleared |
string |
TransactionClearedStatus |
TransactionPayload |
$flagColor |
string |
TransactionFlagColor |
ScheduledTransactionPayload |
$flagColor |
string |
TransactionFlagColor |
ScheduledTransactionPayload |
$frequency |
string |
ScheduledTransactionFrequency |
CreateAccountRequest |
$type |
string |
AccountType |
Migration: Replace raw strings with the corresponding enum cases, e.g.
TransactionClearedStatus::Cleared,TransactionFlagColor::Red,ScheduledTransactionFrequency::Monthly,AccountType::Checking.
Transaction::$isPending removed
This field was not present in the YNAB OpenAPI spec and has been removed.
HTTPS enforced on client base URL
The client now rejects base URLs using http://. All connections must use https://.
ApiKeyAuth and OAuthTokenAuth throw on empty tokens
Constructing either auth class with an empty or whitespace-only string now throws InvalidStringException rather than silently accepting an unusable value.
New Endpoints
Read endpoints
user()— authenticated user infoplans()/defaultPlan()— plan list and default planplan(string $planId)— single plan detailplanSettings(string $planId)— plan settingsaccount(string $planId, string $accountId)— single accountpayee(string $planId, string $payeeId)— single payeecategoryGroups(string $planId)— all category groups with categoriescategoryGroup(string $planId, string $groupId)— single category groupcategory(string $planId, string $categoryId)— single categorymonths(string $planId)— all plan monthsmonth(string $planId, string $month)— single month detail (includes categories)monthCategory(string $planId, string $month, string $categoryId)— category for a specific monthtransaction(string $planId, string $transactionId)— single transaction- Filtered transaction reads by account, category, payee, and month
scheduledTransactions(string $planId)/scheduledTransaction(...)— scheduled transaction list and detailpayeeLocations(string $planId)/payeeLocation(...)— payee location list and detailmoneyMovements(string $planId)/moneyMovementGroups(string $planId)— money movement data
Write endpoints (new in this release)
Full create/update/delete coverage for:
- Transactions —
createTransactions(),importTransactions(),updateTransaction(),patchTransactions(),deleteTransaction() - Scheduled transactions —
createScheduledTransaction(),updateScheduledTransaction(),deleteScheduledTransaction() - Accounts —
createAccount() - Categories —
createCategory(),updateCategory(),updateMonthCategory() - Category groups —
createCategoryGroup(),updateCategoryGroup() - Payees —
updatePayee()
Other Improvements
New typed models
User, PlanSettings, Month, CategoryDetail, CategoryGroup, ScheduledTransaction, MoneyMovement, MoneyMovementGroup, PayeeLocation — all mapping directly from YNAB API responses.
Model interface
All identifiable model classes now implement a Model interface declaring getId(): string. The YnabClient::resolveModelId() method accepts Model|string, so you can pass model objects anywhere an ID string is expected.
ResourceCollection is iterable and countable
ResourceCollection now implements IteratorAggregate and Countable, enabling direct use in foreach loops and with count().
Pagination safety limit
ClientConfig accepts a $maxPages parameter (default: 100) that caps automatic page fetches, preventing runaway requests against large datasets.
OAuthClient::generateState()
Convenience method for generating a cryptographically random OAuth CSRF state parameter:
$state = OAuthClient::generateState(); // returns hex-encoded random bytesOAuth token endpoint validation
OAuthClient now checks the HTTP status code of token endpoint responses before parsing, throwing YnabException on non-2xx responses.
Credential redaction in debug output
ApiKeyAuth, OAuthTokenAuth, OAuthConfig, and OAuthTokens implement __debugInfo() so that var_dump() and print_r() never expose raw API keys, access tokens, or client secrets.
Upgrade Guide
- Replace
budgets()/defaultBudget()withplans()/defaultPlan(), and remove any references to theBudgetmodel. - Replace
$budgetIdwith$planIdin allYnabClientcall sites. - Update mutation model construction to use enum values instead of raw strings.
- Remove any references to
Transaction::$isPending. - Verify your
YnabClientbase URL useshttps://. - Wrap
ApiKeyAuth/OAuthTokenAuthconstruction in a try/catch forInvalidStringExceptionif token values can arrive empty.