承接 devgol/json 相关项目开发

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

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

devgol/json

最新稳定版本:0.1

Composer 安装命令:

composer require devgol/json

包简介

Get and save json data from anywhere.

README 文档

README

require "vendor/autoload.php";

// You can use a one fit all json() function
json($resource, $save_to_file = null, $create_file = true);

// Get the data
$data = getJson('https://api.github.com/users/oussamaelgoumri');        //API resource
$data = getJson('data/content.json');                              //FILE resource
$data = getJson('{"name":"Oussama Elgoumri"}');                    //JSON_STRING resource

var_dump($data['name']);                                        //Access json as you normally do with PHP

// Save the data
saveJson('https://api.github.com/users/oussamaelgoumri', 'output/target_file.json');        //from API resource
saveJson('data/content.json', 'output/target_file.json');                              //from FILE resource
saveJson('{"name":"Oussama Elgoumri"}', 'output/target_file.json');                    //from JSON_STRING resource

// And of course, you can save data to a file directly from an array in php
$data = ['name' => 'Oussama Elgoumri'];
saveJson($data, 'output/target_file.json');

Get json data from any resource, and make it ready to be used from php. Directly save json data from any resource, to a file. Just pass the resource location, Json will take care of the rest.

Installation

composer require devgol/json

Supported resources

  • API Any publicly available api.
  • FILE Any json file on your computer.
  • JSON_STRING make a json string in your php code ready to be parsed.

Features

  • Validate json on the fly.
  • Get json from anywhere.
  • Save json from anywhere to a file.
  • No api to memorise, just getJson($resource) and saveJson($resource, $target_file, $rewrite = true)

Advanced usage

/*
 * json start by evaluating the resource, and fall back in this order if the resource is not valid
 * api -> file -> json_string, so for eg. if you are sure that the resource is API and you want some feedback
 * if it's not available, then:
 */
try {
    $data = json(['https://api.github.com/users/oussamadev' => 'api']);
} catch( ... ) {
    // throw: NotApiResourceException - if the resource can not be accessed.
    // throw: ResourceIsNotJsonException - if the resource does not have json content.
}

/*
 * in case you want to save json content to file, but you don't want the file to be created
 * if it does not exist, then:
 */
try {
    json('{"name":"Oussama Elgoumri"}', 'target_file.txt', false);
} catch ( ... ) {
    // throw: SaveToFileNotFoundException - if the target file does not exists
}

devgol/json 适用场景与选型建议

devgol/json 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 07 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 devgol/json 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 devgol/json 我们能提供哪些服务?
定制开发 / 二次开发

基于 devgol/json 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-14