lemonblast/cbor4php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lemonblast/cbor4php

最新稳定版本:1.0.0

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.

统计信息

  • 总下载量: 120.46k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-09