Note: this library is not finished yet. It will be completed and released on packagist.org during January 2022.
Note: this is not the official PHP client for Coinbase API.
This is a client library for the Coinbase Exchange API that it is related to Coinbase Pro accounts.
You can transfer your funds without any fees from your Coinbase account to your Coinbase Pro account following those instructions.
TODO: update package to packagist.org when finish v1
Login to your Coinbase Pro account and create an API key on this page: https://pro.coinbase.com/profile/api.
Then, save your API key, API passphrase and your API secret.
You can also create a test account in order to test your trades on Coinbase Pro Sandbox.
In the sandbox enviroment you can top-up your accounts with fake currencies amount in order to test your trades.
Then, create a new instance of this library:
$coinbase = new \StevePolite\Coinbase\CoinbaseClient([
'api_key' => '{YOUR API KEY}',
'api_secret' => '{YOUR API SECRET}',
'api_passphrase' => '{YOUR API PASSPHRASE}',
'is_sandbox' => true // true if it is a sandbox API key, false or omit if it is a live API key
]);
TODO: define pagination logic
Get all accounts for a profile (docs)
$accounts = $coinbase->accounts->all();
Get a single account by id (docs)
$account = $coinbase->accounts->retrieve("ACCOUNT_ID");
Get a single account's holds (docs)
$params = [
"before" => ?string,
"after" => ?string,
"limit" => ?int
];
$holds = $coinbase->accounts->holds("ACCOUNT_ID", $params);
Get a single account's ledger (docs)
$params = [
"start_date" => ?string,
"end_date" => ?string,
"before" => ?string,
"after" => ?string,
"limit" => ?int,
"profile_id" => ?string
];
$ledger = $coinbase->accounts->ledger("ACCOUNT_ID", $params);
Get a single account's transfers (docs)
$params = [
"before" => ?string,
"after" => ?string,
"limit" => ?int,
"type" => ?string
];
$transfers = $coinbase->accounts->transfers("ACCOUNT_ID", $params);
Get all Coinbase wallets (docs)
$wallets = $coinbase->coinbase_accounts->all();
Generate crypto address (docs)
$address = $coinbase->coinbase_accounts->address("ACCOUNT_ID");
Convert currency (docs)
$params = [
'profile_id' => ?string,
'from' => string,
'to' => string,
'amount' => string,
'nonce' => ?string
];
$conversion = $coinbase->conversions->convert($params);
Get a conversion (docs)
$params = [
'profile_id' => ?string
];
$conversion = $coinbase->conversions->retrieve("CONVERSION_ID", $params);
Get all know currencies (docs)
$currencies = $coinbase->currencies->all();
Get a currency (docs)
$currency = $coinbase->currencies->retrieve("CURRENCY_ID");