stagerightlabs/phpxdr
Composer 安装命令:
composer require stagerightlabs/phpxdr
包简介
Encode and Decode XDR strings with PHP
关键字:
README 文档
README
This package provides an implementation of the RFC 4506 External Data Representation standard for PHP. It is built to be extensible; you can encode and decode custom data objects as well as primitive generics.
This package is currently in beta; the API is still subject to change.
Important Note: Quadruple-Precision Floating-Point numbers are not supported by this package as a native type. However tools are provided for you to implement this in your own project should you have the need.
Installation
You can install the package via composer:
composer require stagerightlabs/phpxdr
Usage
use StageRightLabs\PhpXdr\XDR; // Encode $xdr = XDR::fresh() ->write(42, XDR::INT) ->write(3.14, XDR::FLOAT) ->write('Bad Wolf', XDR::STRING); $payload = $xdr->asBase64(); // AAAAKkBI9cMAAAAIQmFkIFdvbGY= // Decode $xdr = XDR::fromBase64('AAAAKkBI9cMAAAAIQmFkIFdvbGY='); $int = $xdr->read(XDR::INT); // 42 $float = $xdr->read(XDR::FLOAT); // ~3.14 $string = $xdr->read(XDR::STRING); // 'Bad Wolf'
More implementation and usage details can be found in the wiki.
Testing
./vendor/bin/phpunit
Credits
This package draws a lot of inspiration from both zulucrypto/stellar-api and stellar/js-xdr.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email ryan@stagerightlabs.com instead of using the issue tracker.
License
The Apache License 2. Please see License File for more information.
PHP Package Boilerplate
This package was generated using the PHP Package Boilerplate by Beyond Code.
统计信息
- 总下载量: 5.06k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2021-11-13