jaschilz/bitcoincomputer-php
Composer 安装命令:
composer require jaschilz/bitcoincomputer-php
包简介
Php libraries for bitcoin payment requests in the Bitcoin Computer Project.
README 文档
README
Bitcoin Computer PHP Library
Example
Install BTC-Channel
Download and install btc-channel. Be sure to install a specific payment channel adapter. Complete all configuration instructions.
Download the PHP Bitcoin Computer Library
In your composer.json:
{
"require": {
"jaschilz/bitcoincomputer-php" : "0.*"
}
}
Code
In a page:
<?php
// Load Composer's autoload
require_once dirname(__FILE__) . '/vendor/autoload.php';
use BitcoinComputer\Request\Request;
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;
}
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2016-02-23