Skip to content

steve-polite/coinbase-api-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coinbase API - PHP wrapper

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.

Installation

TODO: update package to packagist.org when finish v1

Authentication

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
]);

Pagination

TODO: define pagination logic

Managed APIs

Accounts

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);

Coinbase Accounts

Get all Coinbase wallets (docs)

$wallets = $coinbase->coinbase_accounts->all();

Generate crypto address (docs)

$address = $coinbase->coinbase_accounts->address("ACCOUNT_ID");

Conversions

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);

Currencies

Get all know currencies (docs)

$currencies = $coinbase->currencies->all();

Get a currency (docs)

$currency = $coinbase->currencies->retrieve("CURRENCY_ID");

About

Coinbase API PHP wrapper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages