定制 eugene-melbourne/json-encoder-decoder 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

eugene-melbourne/json-encoder-decoder

Composer 安装命令:

composer require eugene-melbourne/json-encoder-decoder

包简介

Encodes and Decodes JSON strings

README 文档

README

Encodes and Decodes JSON strings

Installation

$ composer require  eugene-melbourne/json-encoder-decoder

Most importantly it has default parameters pre-set

  • JSON_THROW_ON_ERROR
  • convertEmptyStringToNull
  • ReturnAsAssociative

It can be changed though.

Also, it can ConvertEmptyStringToNull and has unit tests to see it in action.

Example:

// Example 1
$val = (new JsonEncoderDecoder())->json_encode(null)
// $val = null   

// Example 2
$val  = [chr(160),];
$json = (new JsonEncoderDecoder())->json_encode($val);
// throws JsonException

// Example 3
$val  = [chr(160),];
$json = (new JsonEncoderDecoder())
        ->addOption(JSON_INVALID_UTF8_SUBSTITUTE)
        ->json_encode($val);
// $json = '["\ufffd"]';

See more examples in unit tests.

P.S. The char code 160 would be  

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固