{"id":36979016,"url":"https://github.com/oak-labs-io/psd2","last_synced_at":"2026-01-13T22:48:34.562Z","repository":{"id":57029712,"uuid":"111851562","full_name":"oak-labs-io/psd2","owner":"oak-labs-io","description":"API client for banks supporting PSD2 APIs with OAuth2 authentication.","archived":false,"fork":false,"pushed_at":"2017-12-07T17:24:47.000Z","size":16,"stargazers_count":30,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-31T02:35:32.993Z","etag":null,"topics":["api-client","banking","banking-applications","oauth2","oauth2-client","php","psd2"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oak-labs-io.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-23T21:29:16.000Z","updated_at":"2025-04-12T00:15:56.000Z","dependencies_parsed_at":"2022-08-23T18:50:10.815Z","dependency_job_id":null,"html_url":"https://github.com/oak-labs-io/psd2","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/oak-labs-io/psd2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oak-labs-io%2Fpsd2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oak-labs-io%2Fpsd2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oak-labs-io%2Fpsd2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oak-labs-io%2Fpsd2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oak-labs-io","download_url":"https://codeload.github.com/oak-labs-io/psd2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oak-labs-io%2Fpsd2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28403750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","banking","banking-applications","oauth2","oauth2-client","php","psd2"],"created_at":"2026-01-13T22:48:34.495Z","updated_at":"2026-01-13T22:48:34.541Z","avatar_url":"https://github.com/oak-labs-io.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Psd2\n\n[![License](https://poser.pugx.org/oaklabs/psd2/license)](https://packagist.org/packages/oaklabs/psd2)\n[![Latest Stable Version](https://poser.pugx.org/oaklabs/psd2/v/stable)](https://packagist.org/packages/oaklabs/psd2)\n[![Latest Unstable Version](https://poser.pugx.org/oaklabs/psd2/v/unstable)](https://packagist.org/packages/oaklabs/psd2)\n[![Build Status](https://travis-ci.org/oak-labs-io/psd2.svg)](https://travis-ci.org/oak-labs-io/psd2)\n\n## Introduction\n\n\u003e Psd2 is a API client for Banks supporting PSD2 APIs with Oauth2 authentication.\n\nPHP 7.1+ is required.\n\n## Installation\n\nPsd2 can be installed through Composer, just include `\"oaklabs/psd2\": \"^1.0\"` to your composer.json and run `composer update` or `composer install`.\n\n## Supported Banks\n\n - [Fidor Bank](https://www.fidor.de/) ([API Documentation](https://api-docs.fidor.de))\n\n## Usage\n\n\u003e Examples will be described using the Fidor Bank Gateway, but all Bank Gateways use the same methods.\n\nOnce we use fills in his/her own Bank details in the Bank OAuth2 screen, we must handle the callback to with the `state` and `code` variables in order to retrieve the Access Token and therefore being able to use the Bank API.\n\nThe `Connector` class is the class that will take care of instantiate the Bank Gateway.\nCreating a Connector instance is the first step to use Psd2.\n\n### Sandbox\n\nAll Bank Gateways can be used in a sandbox mode, which will make the Banks hit the sandbox API endpoints to allow testing.\n\n### Retrieving the Access Token\n\n```php\n// Let's suppose we saved the state token in a $state variable,\n// the random code in $code and we have a boolean $useSandbox variable\n\n// First of all we need to create an Authorization instance\n\n$authorization = new \\OakLabs\\Psd2\\Authorization\\Authorization([\n    'code' =\u003e $code,\n    'state' =\u003e $state,\n    'redirect_uri' =\u003e 'the redirect_uri your set in your Bank API configuration,\n    'client_id' =\u003e 'the client_id of the bank API,\n    'client_secret' =\u003e 'the client secret of the bank API'\n]);\n\n// Let's now instantiate the Bank Gateway through the Connector\n$tokens = (new Connector($authorization))\n    -\u003egetBankGateway(\n        'fidor',\n        $useSandbox\n    )\n    -\u003eretrieveTokens()\n    -\u003egetTokens();\n\n// $tokens is now an instance of \\League\\OAuth2\\Client\\Token\n\n$accessToken = $tokens-\u003egetToken();\n$refreshToken = $tokens-\u003egetRefreshToken();\n$expiration = $tokens-\u003egetExpires();\n$hasExpired = $tokens-\u003ehasExpired();\n$jsonSerialized = $tokens-\u003ejsonSerialize();\n```\n\n### Retrieving the Accounts\n\n```php\n// After we got the Access Token and we saved it in a $tokens variable\n// we can interact with the Bank API\n\n// In case of a new request, create again the Authorization instance,\n// but this time we don't need state and code\n\n$authorization = new Authorization([\n    'redirect_uri' =\u003e 'the redirect_uri your set in your Bank API configuration,\n    'client_id' =\u003e 'the client_id of the bank API,\n    'client_secret' =\u003e 'the client secret of the bank API'\n]);\n\n$accounts = (new Connector($authorization))\n    -\u003egetBankGateway(\n        'fidor',\n        $useSandbox\n    )\n    -\u003esetAccessToken($accessToken)\n    -\u003egetAccountDetails();\n\n// $accounts is an array of \\OakLabs\\Psd2\\Psd\\AccountDetail\n\nforeach ($accounts as $account) {\n    // $account-\u003egetAccountNumber()\n    // $account-\u003egetBic()\n    // $account-\u003egetBalance()\n    // $account-\u003egetBalanceAvailable()\n    // $account-\u003egetCreatedAt()\n    // $account-\u003egetCurrency()\n    // $account-\u003egetCustomers()\n    // $account-\u003egetIban()\n    // $account-\u003egetId()\n}\n```\n\n### Retrieving SEPA Transactions\n\n```php\n// After we got the Access Token and we saved it in a $tokens variable\n// we can interact with the Bank API\n\n// In case of a new request, create again the Authorization instance,\n// but this time we don't need state and code\n\n$authorization = new Authorization([\n    'redirect_uri' =\u003e 'the redirect_uri your set in your Bank API configuration,\n    'client_id' =\u003e 'the client_id of the bank API,\n    'client_secret' =\u003e 'the client secret of the bank API'\n]);\n\n// Let's now retrieve the SEPA Transactions using the API Pagination\n\n$transactions = (new Connector($authorization))\n    -\u003egetBankGateway(\n        'fidor',\n        $useSandbox\n    )\n    -\u003esetAccessToken($accessToken)\n    -\u003egetSepaTransactions($page, $limit);\n\n// $transactions is an array of \\OakLabs\\Psd2\\Transaction\n\nforeach ($transactions as $transaction) {\n    // $transaction-\u003egetExternalUid()\n    // $transaction-\u003egetAccountUid()\n    // $transaction-\u003egetTransactionUid()\n    // $transaction-\u003egetAmount()\n    // $transaction-\u003egetIban()\n    // $transaction-\u003egetBic()\n    // $transaction-\u003egetDescription()\n    // $transaction-\u003egetCreatedAt()\n}\n```\n\n### Creating a SEPA Transaction\n\n```php\n// After we got the Access Token and we saved it in a $tokens variable\n// we can interact with the Bank API\n\n// In case of a new request, create again the Authorization instance,\n// but this time we don't need state and code\n\n$authorization = new Authorization([\n    'redirect_uri' =\u003e 'the redirect_uri your set in your Bank API configuration,\n    'client_id' =\u003e 'the client_id of the bank API,\n    'client_secret' =\u003e 'the client secret of the bank API'\n]);\n\n// Let's suppose we have a $data array with the transaction we want to create\n$data = [\n    'external_uid' =\u003e '1234567890', // Some uid defined by us\n    'account_id' =\u003e '12345', // The account_id comes from the Bank API and must be retrieved through getAccountDetails . It is NOT the account number\n    'amount' =\u003e 10, // Amount of the transfer\n    'remote_iban' =\u003e 'DE0000000000000000', // IBAN to transfer the money to\n    'bic' =\u003e 'ABCDEFGH', // BIC\n    'subject' =\u003e 'My Description' // Description\n];\n\n$transaction = (new Connector($authorization))\n    -\u003egetBankGateway(\n        'fidor',\n        $useSandbox\n    )\n    -\u003esetAccessToken($accessToken)\n    -\u003ecreateSepaTransaction($data);\n\n// Transaction is an instance of \\OakLabs\\Psd2\\Transaction\n\n// $transaction-\u003egetExternalUid()\n// $transaction-\u003egetAccountUid()\n// $transaction-\u003egetTransactionUid()\n// $transaction-\u003egetAmount()\n// $transaction-\u003egetIban()\n// $transaction-\u003egetBic()\n// $transaction-\u003egetDescription()\n// $transaction-\u003egetCreatedAt()\n```\n\n## Testing\n\nJust call `vendor/bin/phpunit tests` to run the tests.\n\n## Contribution guidelines\n\nPSD2 follows PSR-1, PSR-2 and PSR-4 PHP coding standards, and semantic versioning.\n\nPull requests are welcome.\n\n## License\n\nPSD2 is free software distributed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foak-labs-io%2Fpsd2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foak-labs-io%2Fpsd2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foak-labs-io%2Fpsd2/lists"}