1. Go to this page and download the library: Download matmar10/coinbase-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
matmar10 / coinbase-php example snippets
$coinbase = new Coinbase($_ENV['COINBASE_API_KEY'])
$response = $coinbase->sendMoney("mpJKwdmJKYjiyfNo26eRp4j6qGwuUUnw9x", "0.1", "thanks for the coffee!");
echo $response->transaction->notes;
// 'thanks for the coffee!'
$response = $coinbase->buy('1.0');
echo $response->transfer->code;
// '6H7GYLXZ'
echo $response->transfer->btc->amount;
// '1.00000000'
echo $response->transfer->total->amount;
// '$17.95'
echo $response->transfer->payout_date;
// '2013-02-01T18:00:00-08:00' (ISO 8601 format - can be parsed with the strtotime() function)
$response = $coinbase->sell('1.0');
echo $response->transfer->code;
// 'RD2OC8AL'
echo $response->transfer->btc->amount;
// '1.00000000'
echo $response->transfer->total->amount;
// '$17.95'
echo $response->transfer->payout_date;
// '2013-02-01T18:00:00-08:00' (ISO 8601 format - can be parsed with the strtotime() function)
$response = $coinbase->createButton("Your Order #1234", "42.95", "EUR", "my custom tracking code for this order", array(
"description" => "1 widget at �42.95"
));
echo $response->button->code;
// '93865b9cae83706ae59220c013bc0afd'
echo $response->embedHtml;
// '<div class=\"coinbase-button\" data-code=\"93865b9cae83706ae59220c013bc0afd\"></div><script src=\"https://coinbase.com/assets/button.js\" type=\"text/javascript\"></script>'