jorijn / ynab-sdk-php
(non-official) YNAB API PHP Library
Installs: 1 271
Dependents: 1
Suggesters: 0
Security: 0
Stars: 15
Watchers: 3
Forks: 6
Open Issues: 2
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~1.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is auto-updated.
Last update: 2024-02-04 09:35:33 UTC
README
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
- Account
- AccountResponse
- AccountWrapper
- AccountsResponse
- AccountsWrapper
- BudgetDetailResponse
- BudgetDetailWrapper
- BudgetSettings
- BudgetSettingsResponse
- BudgetSettingsWrapper
- BudgetSummary
- BudgetSummaryResponse
- BudgetSummaryWrapper
- BulkIdWrapper
- BulkIds
- BulkResponse
- BulkTransactions
- CategoriesResponse
- Category
- CategoryGroup
- CategoryGroupsWrapper
- CategoryResponse
- CategoryWrapper
- CurrencyFormat
- DateFormat
- ErrorDetail
- ErrorResponse
- HybridTransactionsResponse
- HybridTransactionsWrapper
- MonthDetailResponse
- MonthDetailWrapper
- MonthSummariesResponse
- MonthSummariesWrapper
- MonthSummary
- Payee
- PayeeLocation
- PayeeLocationResponse
- PayeeLocationWrapper
- PayeeLocationsResponse
- PayeeLocationsWrapper
- PayeeResponse
- PayeeWrapper
- PayeesResponse
- PayeesWrapper
- SaveTransaction
- SaveTransactionWrapper
- ScheduledSubTransaction
- ScheduledTransactionResponse
- ScheduledTransactionSummary
- ScheduledTransactionWrapper
- ScheduledTransactionsResponse
- ScheduledTransactionsWrapper
- SubTransaction
- TransactionResponse
- TransactionSummary
- TransactionWrapper
- TransactionsResponse
- TransactionsWrapper
- User
- UserResponse
- UserWrapper
- BudgetDetail
- CategoryGroupWithCategories
- HybridTransaction
- MonthDetail
- ScheduledTransactionDetail
- TransactionDetail
Documentation For Authorization
bearer
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header