judahnator/json-manipulator 问题修复 & 功能扩展

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

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

judahnator/json-manipulator

最新稳定版本:v4.0.0

Composer 安装命令:

composer require judahnator/json-manipulator

包简介

A library for JSON string manipulation

README 文档

README

pipeline status coverage report

What is this?

The short version is it's a library that allows you to interact with JSON strings in a more natural way, as if they were native PHP variables.

Usage

The main class you will be using is \judahnator\JsonManipulator\Json.

It is set up automatically when using the factory function, \judahnator\JsonManipulator\load_json().

For example:

<?php

use function judahnator\JsonManipulator\load_json;

$jsonString = '{"foo":"bar"}';
load_json($jsonString)['foo'] = 'baz';

echo $jsonString; 
// '{"foo":"baz"}'

You may also work with nested properties.

<?php

use function judahnator\JsonManipulator\load_json;

$jsonString = '{"foo":["bar","baz"]}';
$jsonObject = load_json($jsonString);
$jsonObject['foo'][] = 'bong';

echo $jsonString; 
// '{"foo":["bar","baz", "bong"]}'

You can also add/remove objects and arrays freely.

<?php

use function judahnator\JsonManipulator\load_json;

$jsonObject = load_json();
$jsonObject['object'] = ['foo' => 'bar'];
$jsonObject['array'] = ['zero', 'one', 'two'];

echo $jsonObject; 
// {"object":{"foo":"bar"},"array":["zero","one","two"]}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-02