{"id":19630977,"url":"https://github.com/neto737/coinbase-php","last_synced_at":"2026-04-28T16:39:11.778Z","repository":{"id":46330185,"uuid":"422573274","full_name":"neto737/coinbase-php","owner":"neto737","description":"PHP wrapper for the Coinbase API","archived":false,"fork":false,"pushed_at":"2021-11-04T13:56:21.000Z","size":338,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-21T16:02:55.501Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neto737.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-29T12:48:42.000Z","updated_at":"2021-11-05T01:26:26.000Z","dependencies_parsed_at":"2022-09-19T10:01:04.616Z","dependency_job_id":null,"html_url":"https://github.com/neto737/coinbase-php","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/neto737/coinbase-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neto737%2Fcoinbase-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neto737%2Fcoinbase-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neto737%2Fcoinbase-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neto737%2Fcoinbase-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neto737","download_url":"https://codeload.github.com/neto737/coinbase-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neto737%2Fcoinbase-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32390053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: 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":[],"created_at":"2024-11-11T12:07:17.629Z","updated_at":"2026-04-28T16:39:11.753Z","avatar_url":"https://github.com/neto737.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coinbase Wallet PHP Library\n\n[![Build Status](https://api.travis-ci.com/neto737/coinbase-php.svg?branch=main)](https://travis-ci.com/github/neto737/coinbase-php)\n[![Latest Stable Version](https://poser.pugx.org/neto737/coinbase/v/stable)](https://packagist.org/packages/neto737/coinbase)\n[![Total Downloads](https://poser.pugx.org/neto737/coinbase/downloads)](https://packagist.org/packages/neto737/coinbase)\n[![Latest Unstable Version](https://poser.pugx.org/neto737/coinbase/v/unstable)](https://packagist.org/packages/neto737/coinbase)\n[![License](https://poser.pugx.org/neto737/coinbase/license)](https://packagist.org/packages/neto737/coinbase)\n\nThis is a fork of the [official client library][2] for the [Coinbase Wallet API v2][1]. We\nprovide an intuitive, stable interface to integrate Coinbase Wallet into your\nPHP project.\n\n_Important:_ As this library is targeted for newer API v2, it requires v2\npermissions (i.e. `wallet:accounts:read`).\n\n## Installation\n\nInstall the library using Composer. Please read the [Composer Documentation](https://getcomposer.org/doc/01-basic-usage.md) if you are unfamiliar with Composer or dependency managers in general.\n\n```json\n\"require\": {\n    \"neto737/coinbase\": \"~2.0\"\n}\n```\n\n## Authentication\n\n### API Key\n\nUse an API key and secret to access your own Coinbase account.\n\n```php\nuse Coinbase\\Wallet\\Client;\nuse Coinbase\\Wallet\\Configuration;\n\n$configuration = Configuration::apiKey($apiKey, $apiSecret);\n$client = Client::create($configuration);\n```\n\n### OAuth2\n\nUse OAuth2 authentication to access a user's account other than your own. This\nlibrary does not handle the handshake process, and assumes you have an access\ntoken when it's initialized. You can handle the handshake process using an\n[OAuth2 client][5] such as [league/oauth2-client][6].\n\n```php\nuse Coinbase\\Wallet\\Client;\nuse Coinbase\\Wallet\\Configuration;\n\n// with a refresh token\n$configuration = Configuration::oauth($accessToken, $refreshToken);\n\n// without a refresh token\n$configuration = Configuration::oauth($accessToken);\n\n$client = Client::create($configuration);\n```\n\n### Two factor authentication\n\nThe send money endpoint requires a 2FA token in certain situations (read more\n[here][3]). A specific exception is thrown when this is required.\n\n```php\nuse Coinbase\\Wallet\\Enum\\Param;\nuse Coinbase\\Wallet\\Exception\\TwoFactorRequiredException;\nuse Coinbase\\Wallet\\Resource\\Transaction;\n\n$transaction = Transaction::send([\n    'toEmail' =\u003e 'test@test.com',\n    'bitcoinAmount' =\u003e 1\n]);\n\n$account = $client-\u003egetPrimaryAccount();\ntry {\n    $client-\u003ecreateAccountTransaction($account, $transaction);\n} catch (TwoFactorRequiredException $e) {\n    // show 2FA dialog to user and collect 2FA token\n\n    // retry call with token\n    $client-\u003ecreateAccountTransaction($account, $transaction, [\n        Param::TWO_FACTOR_TOKEN =\u003e '123456',\n    ]);\n}\n```\n\n### Pagination\n\nSeveral endpoints are [paginated][4]. By default, the library will only fetch\nthe first page of data for a given request. You can easily load more than just\nthe first page of results.\n\n```php\n$transactions = $client-\u003egetAccountTransactions($account);\nwhile ($transactions-\u003ehasNextPage()) {\n    $client-\u003eloadNextTransactions($transactions);\n}\n```\n\nYou can also use the `fetch_all` parameter to have the library issue all the\nnecessary requests to load the complete collection.\n\n```php\nuse Coinbase\\Wallet\\Enum\\Param;\n\n$transactions = $client-\u003egetAccountTransactions($account, [\n    Param::FETCH_ALL =\u003e true,\n]);\n```\n\n### Warnings\n\nIt's prudent to be conscious of warnings. The library will log all warnings to a\nstandard PSR-3 logger if one is configured.\n\n```php\nuse Coinbase\\Wallet\\Client;\nuse Coinbase\\Wallet\\Configuration;\n\n$configuration = Configuration::apiKey($apiKey, $apiSecret);\n$configuration-\u003esetLogger($logger);\n$client = Client::create($configuration);\n```\n\n### Resource references\n\nIn some cases the API will return resource references in place of expanded\nresource objects. These references can be expanded by refreshing them.\n\n```php\n$deposit = $this-\u003eclient-\u003egetAccountDeposit($account, $depositId);\n$transaction = $deposit-\u003egetTransaction();\nif (!$transaction-\u003eisExpanded()) {\n    $this-\u003eclient-\u003erefreshTransaction($transaction);\n}\n```\n\nYou can also request that the API return an expanded resource in the initial\nrequest by using the `expand` parameter.\n\n```php\nuse Coinbase\\Wallet\\Enum\\Param;\n\n$deposit = $this-\u003eclient-\u003egetAccountDeposit($account, $depositId, [\n    Param::EXPAND = ['transaction'],\n]);\n```\n\nResource references can be used when creating new resources, avoiding the\noverhead of requesting a resource from the API.\n\n```php\nuse Coinbase\\Wallet\\Resource\\Deposit;\nuse Coinbase\\Wallet\\Resource\\PaymentMethod;\n\n$deposit = new Deposit([\n    'paymentMethod' =\u003e PaymentMethod::reference($paymentMethodId)\n]);\n\n// or use the convenience method\n$deposit = new Deposit([\n    'paymentMethodId' =\u003e $paymentMethodId\n]);\n```\n\n### Responses\n\nThere are multiple ways to access raw response data. First, each resource\nobject has a `getRawData()` method which you can use to access any field that\nare not mapped to the object properties.\n\n```php\n$data = $deposit-\u003egetRawData();\n```\n\nRaw data from the last HTTP response is also available on the client object.\n\n```php\n$data = $client-\u003edecodeLastResponse();\n```\n\n### Active record methods\n\nThe library includes support for active record methods on resource objects. You\nmust enable this functionality when bootstrapping your application.\n\n```php\n$client-\u003eenableActiveRecord();\n```\n\nOnce enabled, you can call active record methods on resource objects.\n\n```php\nuse Coinbase\\Wallet\\Enum\\Param;\n\n$transactions = $account-\u003egetTransactions([\n    Param::FETCH_ALL =\u003e true,\n]);\n```\n\n## Usage\n\nThis is not intended to provide complete documentation of the API. For more\ndetail, please refer to the\n[official documentation](https://developers.coinbase.com/api/v2).\n\n### [Market Data](https://developers.coinbase.com/api/v2#data-api)\n\n**List supported native currencies**\n\n```php\n$currencies = $client-\u003egetCurrencies();\n```\n\n**List exchange rates**\n\n```php\n$rates = $client-\u003egetExchangeRates();\n```\n\n**Buy price**\n\n```php\n$buyPrice = $client-\u003egetBuyPrice('BTC-USD');\n```\n\n**Sell price**\n\n```php\n$sellPrice = $client-\u003egetSellPrice('BTC-USD');\n```\n\n**Spot price**\n\n```php\n$spotPrice = $client-\u003egetSpotPrice('BTC-USD');\n```\n\n**Current server time**\n\n```php\n$time = $client-\u003egetTime();\n```\n\n### [Users](https://developers.coinbase.com/api/v2#users)\n\n**Get authorization info**\n\n```php\n$auth = $client-\u003egetCurrentAuthorization();\n```\n\n**Lookup user info**\n\n```php\n$user = $client-\u003egetUser($userId);\n```\n\n**Get current user**\n\n```php\n$user = $client-\u003egetCurrentUser();\n```\n\n**Update current user**\n\n```php\n$user-\u003esetName('New Name');\n$client-\u003eupdateCurrentUser($user);\n```\n\n### [Accounts](https://developers.coinbase.com/api/v2#accounts)\n\n**List all accounts**\n\n```php\n$accounts = $client-\u003egetAccounts();\n```\n\n**List account details**\n\n```php\n$account = $client-\u003egetAccount($accountId);\n```\n\n**List primary account details**\n\n```php\n$account = $client-\u003egetPrimaryAccount();\n```\n\n**Set account as primary**\n\n```php\n$client-\u003esetPrimaryAccount($account);\n```\n\n**Create a new bitcoin account**\n\n```php\nuse Coinbase\\Wallet\\Resource\\Account;\n\n$account = new Account([\n    'name' =\u003e 'New Account'\n]);\n$client-\u003ecreateAccount($account);\n```\n\n**Update an account**\n\n```php\n$account-\u003esetName('New Account Name');\n$client-\u003eupdateAccount($account):\n```\n\n**Delete an account**\n\n```php\n$client-\u003edeleteAccount($account);\n```\n\n### [Addresses](https://developers.coinbase.com/api/v2#addresses)\n\n**List receive addresses for account**\n\n```php\n$addresses = $client-\u003egetAccountAddresses($account);\n```\n\n**Get receive address info**\n\n```php\n$address = $client-\u003egetAccountAddress($account, $addressId);\n```\n\n**List transactions for address**\n\n```php\n$transactions = $client-\u003egetAddressTransactions($address);\n```\n\n**Create a new receive address**\n\n```php\nuse Coinbase\\Wallet\\Resource\\Address;\n\n$address = new Address([\n    'name' =\u003e 'New Address'\n]);\n$client-\u003ecreateAccountAddress($account, $address);\n```\n\n### [Transactions](https://developers.coinbase.com/api/v2#transactions)\n\n**List transactions**\n\n```php\n$transactions = $client-\u003egetAccountTransactions($account);\n```\n\n**Get transaction info**\n\n```php\n$transaction = $client-\u003egetAccountTransaction($account, $transactionId);\n```\n\n**Send funds**\n\n```php\nuse Coinbase\\Wallet\\Enum\\CurrencyCode;\nuse Coinbase\\Wallet\\Resource\\Transaction;\nuse Coinbase\\Wallet\\Value\\Money;\n\n$transaction = Transaction::send([\n    'toBitcoinAddress' =\u003e 'ADDRESS',\n    'amount'           =\u003e new Money(5, CurrencyCode::USD),\n    'description'      =\u003e 'Your first bitcoin!',\n    'fee'              =\u003e '0.0001' // only required for transactions under BTC0.0001\n]);\n\ntry { $client-\u003ecreateAccountTransaction($account, $transaction); }\ncatch(Exception $e) {\n     echo $e-\u003egetMessage(); \n}\n```\n\n**Transfer funds to a new account**\n\n```php\nuse Coinbase\\Wallet\\Resource\\Transaction;\nuse Coinbase\\Wallet\\Resource\\Account;\n\n$fromAccount = Account::reference($accountId);\n\n$toAccount = new Account([\n    'name' =\u003e 'New Account'\n]);\n$client-\u003ecreateAccount($toAccount);\n\n$transaction = Transaction::transfer([\n    'to'            =\u003e $toAccount,\n    'bitcoinAmount' =\u003e 1,\n    'description'   =\u003e 'Your first bitcoin!'\n]);\n\n$client-\u003ecreateAccountTransaction($fromAccount, $transaction);\n```\n\n**Request funds**\n\n```php\nuse Coinbase\\Wallet\\Enum\\CurrencyCode;\nuse Coinbase\\Wallet\\Resource\\Transaction;\nuse Coinbase\\Wallet\\Value\\Money;\n\n$transaction = Transaction::request([\n    'amount'      =\u003e new Money(8, CurrencyCode::USD),\n    'description' =\u003e 'Burrito'\n]);\n\n$client-\u003ecreateAccountTransaction($transaction);\n```\n\n**Resend request**\n\n```php\n$account-\u003eresendTransaction($transaction);\n```\n\n**Cancel request**\n\n```php\n$account-\u003ecancelTransaction($transaction);\n```\n\n**Fulfill request**\n\n```php\n$account-\u003ecompleteTransaction($transaction);\n```\n\n### [Buys](https://developers.coinbase.com/api/v2#buys)\n\n**List buys**\n\n```php\n$buys = $client-\u003egetAccountBuys($account);\n```\n\n**Get buy info**\n\n```php\n$buy = $client-\u003egetAccountBuy($account, $buyId);\n```\n\n**Buy bitcoins**\n\n```php\nuse Coinbase\\Wallet\\Resource\\Buy;\n\n$buy = new Buy([\n    'bitcoinAmount' =\u003e 1\n]);\n\n$client-\u003ecreateAccountBuy($account, $buy);\n```\n\n**Commit a buy**\n\nYou only need to do this if you pass `commit=false` when you create the buy.\n\n```php\nuse Coinbase\\Wallet\\Enum\\Param;\n\n$client-\u003ecreateAccountBuy($account, $buy, [Param::COMMIT =\u003e false]);\n$client-\u003ecommitBuy($buy);\n```\n\n### [Sells](https://developers.coinbase.com/api/v2#sells)\n\n\u003c!-- **List sells**\n\n```php\n$sells = $client-\u003egetSells($account);\n``` --\u003e\n\n**Get sell info**\n\n```php\n$sell = $client-\u003egetAccountSell($account, $sellId);\n```\n\n**Sell bitcoins**\n\n```php\nuse Coinbase\\Wallet\\Resource\\Sell;\n\n$sell = new Sell([\n    'bitcoinAmount' =\u003e 1\n]);\n\n$client-\u003ecreateAccountSell($account, $sell);\n```\n\n**Commit a sell**\n\nYou only need to do this if you pass `commit=false` when you create the sell.\n\n```php\nuse Coinbase\\Wallet\\Enum\\Param;\n\n$client-\u003ecreateAccountSell($account, $sell, [Param::COMMIT =\u003e false]);\n$client-\u003ecommitSell($sell);\n```\n\n### [Deposit](https://developers.coinbase.com/api/v2#deposits)\n\n**List deposits**\n\n```php\n$deposits = $client-\u003egetAccountDeposits($account);\n```\n\n**Get deposit info**\n\n```php\n$deposit = $client-\u003egetAccountDeposit($account, $depositId);\n```\n\n**Deposit funds**\n\n```php\nuse Coinbase\\Wallet\\Enum\\CurrencyCode;\nuse Coinbase\\Wallet\\Resource\\Deposit;\nuse Coinbase\\Wallet\\Value\\Money;\n\n$deposit = new Deposit([\n    'amount' =\u003e new Money(10, CurrencyCode::USD)\n]);\n\n$client-\u003ecreateAccountDeposit($account, $deposit);\n```\n\n**Commit a deposit**\n\nYou only need to do this if you pass `commit=false` when you create the deposit.\n\n```php\nuse Coinbase\\Wallet\\Enum\\Param;\n\n$client-\u003ecreateAccountDeposit($account, $deposit, [Param::COMMIT =\u003e false]);\n$client-\u003ecommitDeposit($deposit);\n```\n\n### [Withdrawals](https://developers.coinbase.com/api/v2#withdrawals)\n\n**List withdrawals**\n\n```php\n$withdrawals = $client-\u003egetAccountWithdrawals($account);\n```\n\n**Get withdrawal**\n\n```php\n$withdrawal = $client-\u003egetAccountWithdrawal($account, $withdrawalId);\n```\n\n**Withdraw funds**\n\n```php\nuse Coinbase\\Wallet\\Enum\\CurrencyCode;\nuse Coinbase\\Wallet\\Resource\\Withdrawal;\nuse Coinbase\\Wallet\\Value\\Money;\n\n$withdrawal = new Withdrawal([\n    'amount' =\u003e new Money(10, CurrencyCode::USD)\n]);\n\n$client-\u003ecreateAccountWithdrawal($account, $withdrawal);\n```\n\n**Commit a withdrawal**\n\nYou only need to do this if you pass `commit=true` when you call the withdrawal method.\n\n```php\nuse Coinbase\\Wallet\\Enum\\Param;\n\n$client-\u003ecreateAccountWithdrawal($account, $withdrawal, [Param::COMMIT =\u003e false]);\n$client-\u003ecommitWithdrawal($withdrawal);\n```\n\n### [Payment Methods](https://developers.coinbase.com/api/v2#payment-methods)\n\n**List payment methods**\n\n```php\n$paymentMethods = $client-\u003egetPaymentMethods();\n```\n\n**Get payment method**\n\n```php\n$paymentMethod = $client-\u003egetPaymentMethod($paymentMethodId);\n```\n\n## Contributing and testing\n\nThe test suite is built using PHPUnit. Run the suite of unit tests by running\nthe `phpunit` command.\n\n```\nphpunit\n```\n\nThere is also a collection of integration tests that issues real requests to the\nAPI and inspects the resulting objects. To run these tests, you must copy\n`phpunit.xml.dist` to `phpunit.xml`, provide values for the `CB_API_KEY` and\n`CB_API_SECRET` variables, and specify the `integration` group when running the\ntest suite.\n\n```\nphpunit --group integration\n```\n\n[1]: https://developers.coinbase.com/api/v2\n[2]: https://github.com/coinbase/coinbase-php\n[3]: https://developers.coinbase.com/docs/wallet/coinbase-connect#two-factor-authentication\n[4]: https://developers.coinbase.com/api/v2#pagination\n[5]: https://packagist.org/search/?q=oauth2%20client\n[6]: https://packagist.org/packages/league/oauth2-client\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneto737%2Fcoinbase-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneto737%2Fcoinbase-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneto737%2Fcoinbase-php/lists"}