https://github.com/chawuciren/php-bytebuffer
Handle binary data in a modern and minimalist way
https://github.com/chawuciren/php-bytebuffer
Last synced: 2 months ago
JSON representation
Handle binary data in a modern and minimalist way
- Host: GitHub
- URL: https://github.com/chawuciren/php-bytebuffer
- Owner: chawuciren
- Created: 2019-06-26T09:29:59.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-31T06:59:34.000Z (almost 6 years ago)
- Last Synced: 2025-03-03T07:32:16.591Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### php-bytebuffer
  
## 关于
使用现代并且简约的方式来处理二进制数据
## 安装方式
开始安装:
#### 1.安装方式一,通过composer 安装
composer require chawuciren/bignumber
#### 2.安装方式二,直接下载并 include
直接下载源码,引入 src/ByteBuffer.php
## 开始使用
初始化中传入的数值应使用字符串,譬如有一个取出数值并计算后返回给前端的接口,数据库中存储的类型为 decimal 时,应优先将取出的值初始化为 BigNumber,然后在代码中使用 BigNumber 进行计算,后在接口返回处使用:value() 方法获取字符串型的数值输出
#### 1.方式一:使用 new 语句
use \chawuciren\ByteBuffer;
$buffer = new ByteBuffer('BufferString');
#### 2.方式二:使用静态方法 build
use \chawuciren\ByteBuffer;
$number = ByteBuffer::from('BufferString');#### 3.方式三:使用 fill 方法赋值
$number = new \chawuciren\BigNumber(10);
$number->fill('BufferString');