openclerk/cryptocurrencies
Composer 安装命令:
composer require openclerk/cryptocurrencies
包简介
Definitions and implementations of cryptocurrencies in Openclerk
README 文档
README
A library for accessing balances, block counts and difficulties of common cryptocurrencies, used by Openclerk and live on CryptFolio.
This extends on the abstract currency definitions provided by openclerk/currencies.
Installing
Include openclerk/cryptocurrencies as a requirement in your project composer.json,
and run composer update to install it into your project:
{
"require": {
"openclerk/cryptocurrencies": "dev-master"
}
}
PHP 5.4.6+ is required because some APIs require cURL 7.24+ due to the POODLE SSL bug.
Using
Get the balance for a certain address:
use \Monolog\Logger; $logger = new Logger("log"); $currency = new \Cryptocurrencies\Dogecoin(); $balance = $currency->getBalance("D64vbPp9TvqQ67xc6we5GnEtcKqiTXfp1S", $logger);
Get the balance for a certain address with a number of confirmations:
$currency = new \Cryptocurrencies\Bitcoin(); $balance = $currency->getBalanceWithConfirmations("17eTMdqaFRSttfBYB9chKEzHubECZPTS6p", 6, $logger);
Get the current difficulty of a given cryptocurrency:
$currency = new \Cryptocurrencies\Litecoin(); $balance = $currency->getDifficulty($logger);
Check whether a given address is valid:
$currency = new \Cryptocurrencies\Bitcoin(); return $currency->isValid("17eTMdqaFRSttfBYB9chKEzHubECZPTS6p");
Tests
Each cryptocurrency comes with a suite of tests to check each associated service.
composer install
vendor/bin/phpunit
To run the tests for a single currency:
vendor/bin/phpunit --bootstrap "vendor/autoload.php" test/DogecoinTest
To get debug output for the tests (such as CURL requests and decoded output),
add the --debug switch to your vendor/bin/phpunit command.
Assets
Assets for each cryptocurrency, for example icons associated with the currency and
associated services, are provided in css/ and images/.
These can be included into your project with asset-discovery and mixins are provided, for example:
@each $code in $currency-codes { .currency_name.currency_#{$code}, .currency_name_#{$code} { padding-left: 20px; @include currency-label-background($code); background-position: 0 0; background-repeat: no-repeat; background-size: 16px 16px; } }
Donate
Contributing
Pull requests that contribute new currencies, services or APIs are welcome.
For new currencies, make sure that you also provide an associated
CurrencyTest so that the currency is automatically testable.
TODO
- Generate README list of currencies/services automatically
- Provide 32x32 icons for each cryptocurrency
- Link to live APIs on CryptFolio
- CI build server and link to test results
openclerk/cryptocurrencies 适用场景与选型建议
openclerk/cryptocurrencies 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 251 次下载、GitHub Stars 达 4, 最近一次更新时间为 2014 年 12 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 openclerk/cryptocurrencies 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 openclerk/cryptocurrencies 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 251
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 15
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-12-29