lemonblast/cbor4php
Composer 安装命令:
composer require lemonblast/cbor4php
包简介
CBOR encoder/decoder for PHP
README 文档
README
CBOR (Concise Binary Object Representation) is a tiny data format that can be used in place of JSON. Cbor4Php is a simple CBOR encoder/decoder for PHP.
Installation
To install the library through composer, you simply need to add the following to composer.json and run composer update or composer install:
{ "require": { "lemonblast/cbor4php": "dev-master" } }
Once installed, you can use the Cbor class (Lemonblast\Cbor4Php\Cbor) to encode and decode CBOR data.
Usage
Include the Cbor4Php library in your source:
use Lemonblast\Cbor4Php\Cbor;
Encoding
To encode a variable into a CBOR byte string call the encode method and pass the value as a parameter:
$foo = Cbor::encode($bar);
Encoding an object will convert it to an associative array, and encode it as such. Only public fields will be encoded.
Encoding a PHP resource is not supported and will result in a null return value.
Decoding
To decode a CBOR byte string into a PHP variable:
$bar = Cbor::decode($foo);
CBOR data tags are ignored during the decode process. Decoding a null value or empty string will result in a null return value.
Testing
To run unit tests, simply clone this repository and run composer install followed by php vendor/bin/phpunit in the project directory.
lemonblast/cbor4php 适用场景与选型建议
lemonblast/cbor4php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 248k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 01 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「cbor」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lemonblast/cbor4php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lemonblast/cbor4php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lemonblast/cbor4php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CBOR encoder for PHP
CBOR Encoder/Decoder for PHP
CBOR Encoder/Decoder Bundle for Symfony.
CBOR decoder
A CBOR encoder/decoder for PHP
CBOR, CAR, and CID binary encoding for AT Protocol in PHP
统计信息
- 总下载量: 248k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 31
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-09