承接 sgpinkus/jsonref 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

sgpinkus/jsonref

Composer 安装命令:

composer require sgpinkus/jsonref

包简介

A PHP JSON Reference dereferencer

README 文档

README

This library implements JSON Reference v0.4.0 and by extension JSON Pointer (JSON Reference requires JSON Pointer) for PHP. JSON Reference v0.4.0 succeeds JSON Reference v0.3.0 and is not entirely backwards compatible.

This library replaces JSON references in a JSON document with native PHP references to parts of the same decoded JSON document, or parts of some other decoded JSON document referred to by URI. It supports doing this on an existing decoded JSON document data structures, or loading and decoding the JSON document from a URL.

NOTE: Pre-encode, normalization of objects is not yet supported.

INSTALLATION

composer install

TESTS

composer test

SYNOPSIS

The following show various ways of loading and dereferencing a JSON document:

<?php
require_once './vendor/autoload.php';
use JsonRef\JsonDocs;
use JsonRef\JsonLoader;

// Loader is optional. The default loader will throw an exception if any non local refs are encountered.
// strictIds option forces `$id` values to be valid anchor names. But many documents use arbitrary strings.
$strictIds = false;
$jsonDocs = new JsonDocs(new JsonLoader(), $strictIds);
$myUri = 'file://' . realpath('./tests/test-data/basic-refs.json');

$doc = $jsonDocs->loadUri($myUri);
var_dump($doc);
$doc2 = $jsonDocs->loadUri($myUri);
var_dump($doc === $doc2); // true

$strDoc = file_get_contents(realpath('./tests/test-data/basic-refs.json'));
$doc = $jsonDocs->loadDocStr($strDoc, 'file:///tmp/some/fake/unique/path');
var_dump($doc);

// Or if the doc is already decoded.
$objDoc = json_decode($strDoc);
$doc = $jsonDocs->loadDocObj($objDoc, 'file:///tmp/some/fake/unique/path2');
var_dump($doc);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2021-05-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固