Skip to content
(non-official) YNAB API PHP Library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
generate
src
test
.gitignore
.swagger-codegen-ignore
.travis.yml
README.md
composer.json
composer.lock
phpunit.xml.dist
swagger.json

README.md

YNAB-SDK-PHP

Latest Stable Version Total Downloads License Monthly Downloads Build Status

Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.PhpClientCodegen

Requirements

PHP 7.1 and later

Installation & Usage

Composer

To install the bindings via Composer, execute the following command:

$ composer require jorijn/ynab-sdk-php

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/YNAB-SDK-PHP/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: bearer
$config = YNAB\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
$config = YNAB\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new YNAB\Client\AccountsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$budgetId = "budgetId_example"; // string | The ID of the Budget.  \"last-used\" can also be used to specify the last used budget.
$accountId = "accountId_example"; // string | The ID of the Account.

try {
    $result = $apiInstance->getAccountById($budgetId, $accountId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AccountsApi->getAccountById: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to https://api.youneedabudget.com/v1

Class Method HTTP request Description
AccountsApi getAccountById GET /budgets/{budget_id}/accounts/{account_id} Single account
AccountsApi getAccounts GET /budgets/{budget_id}/accounts Account list
BudgetsApi getBudgetById GET /budgets/{budget_id} Single budget
BudgetsApi getBudgetSettingsById GET /budgets/{budget_id}/settings Budget Settings
BudgetsApi getBudgets GET /budgets List budgets
CategoriesApi getCategories GET /budgets/{budget_id}/categories List categories
CategoriesApi getCategoryById GET /budgets/{budget_id}/categories/{category_id} Single category
MonthsApi getBudgetMonth GET /budgets/{budget_id}/months/{month} Single budget month
MonthsApi getBudgetMonths GET /budgets/{budget_id}/months List budget months
PayeeLocationsApi getPayeeLocationById GET /budgets/{budget_id}/payee_locations/{payee_location_id} Single payee location
PayeeLocationsApi getPayeeLocations GET /budgets/{budget_id}/payee_locations List payee locations
PayeeLocationsApi getPayeeLocationsByPayee GET /budgets/{budget_id}/payees/{payee_id}/payee_locations List locations for a payee
PayeesApi getPayeeById GET /budgets/{budget_id}/payees/{payee_id} Single payee
PayeesApi getPayees GET /budgets/{budget_id}/payees List payees
ScheduledTransactionsApi getScheduledTransactionById GET /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id} Single scheduled transaction
ScheduledTransactionsApi getScheduledTransactions GET /budgets/{budget_id}/scheduled_transactions List scheduled transactions
TransactionsApi bulkCreateTransactions POST /budgets/{budget_id}/transactions/bulk Bulk create transactions
TransactionsApi createTransaction POST /budgets/{budget_id}/transactions Create new transaction
TransactionsApi getTransactionById GET /budgets/{budget_id}/transactions/{transaction_id} Single transaction
TransactionsApi getTransactions GET /budgets/{budget_id}/transactions List transactions
TransactionsApi getTransactionsByAccount GET /budgets/{budget_id}/accounts/{account_id}/transactions List account transactions
TransactionsApi getTransactionsByCategory GET /budgets/{budget_id}/categories/{category_id}/transactions List category transactions
TransactionsApi getTransactionsByPayee GET /budgets/{budget_id}/payees/{payee_id}/transactions List payee transactions
TransactionsApi updateTransaction PUT /budgets/{budget_id}/transactions/{transaction_id} Updates an existing transaction
UserApi getUser GET /user User info

Documentation For Models

Documentation For Authorization

bearer

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author

You can’t perform that action at this time.