PHP code example of jaschilz / bitcoincomputer-php
1. Go to this page and download the library: Download jaschilz/bitcoincomputer-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/ */
jaschilz / bitcoincomputer-php example snippets
{
"chilz/bitcoincomputer-php" : "0.*"
}
}
// Load Composer's autoload
use BitcoinComputer\Request\RequestBuilder;
session_start();
/** @var boolean $sessionHasRequest */
$sessionHasRequest = isset($_SESSION['request']);
if (!$sessionHasRequest) {
$_SESSION['request'] = RequestBuilder::begin()
->setSatoshi(400000)
->build();
}
/** @var Request $request */
$request = $_SESSION['request'];
if ($request->isPaid()) {
// In this case, your request has been paid. Satisfy your visitor!
} else {
echo $request;
}