submtd/cashaddr-converter
最新稳定版本:1.0.1
Composer 安装命令:
composer require submtd/cashaddr-converter
包简介
Converts old Bitcoin Cash addresses to the new CashAddr format and vice versa
README 文档
README
Converts old Bitcoin Cash addresses to the new CashAddr format and vice versa in a Laravel friendly package. Based off Har01d's CashAddressPHP code.
Installation
Begin by pulling in the package through Composer.
composer require submtd/cashaddr-converter
Next, if you are using Laravel 5.4, you will need to include the service provider and optionally, the alias in your config/app.php file. If you are using Laravel 5.5, these will be discovered automatically.
'providers' => [ Submtd\CashaddrConverter\Providers\CashaddrConverterServiceProvider::class, ]; 'aliases' => [ 'CashaddrConverter' => Submtd\CashaddrConverter\Facades\CashaddrConverterFacade::class, ];
Usage
A facade and a helper function are provided to make it super simple to use.
Using the facade
// convert from a legacy address to a cashaddr address $legacyAddress = '1PchCm7XXAjifhpchPB8wR2WG5rzMFqjnR'; CashaddrConverter::convertToCashaddr($legacyAddress); // returns bitcoincash:qrup9c40gr9usrz6m7rg7rknjmsp685r2yhxkdx8tf // convert from a cashaddr address to a legacy address $cashaddrAddress = 'bitcoincash:qrup9c40gr9usrz6m7rg7rknjmsp685r2yhxkdx8tf'; CashaddrConverter::convertFromCashaddr($cashaddrAddress); // returns 1PchCm7XXAjifhpchPB8wR2WG5rzMFqjnR
Using the helper functions
// convert from a legacy address to a cashaddr address $legacyAddress = '1PchCm7XXAjifhpchPB8wR2WG5rzMFqjnR'; convertToCashaddr($legacyAddress); // returns bitcoincash:qrup9c40gr9usrz6m7rg7rknjmsp685r2yhxkdx8tf // convert from a cashaddr address to a legacy address $cashaddrAddress = 'bitcoincash:qrup9c40gr9usrz6m7rg7rknjmsp685r2yhxkdx8tf'; convertFromCashaddr($cashaddrAddress); // returns 1PchCm7XXAjifhpchPB8wR2WG5rzMFqjnR
Donation
If this project helped you save some development time, feel free to buy me a beer ;)
统计信息
- 总下载量: 67.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-23