承接 jess/jsonkit-php 相关项目开发

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

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

jess/jsonkit-php

最新稳定版本:v1.0.2

Composer 安装命令:

composer require jess/jsonkit-php

包简介

A lightweight PHP library for reading, writing, and managing JSON files.

README 文档

README

JsonFileManager is a lightweight PHP class for simple, robust manipulation of JSON files—read, write, update, search, and remove using dot notation.

Installation

Install via Composer:

composer require jess/jsonkit-php

Usage

Quick Start

use Jess\JsonkitPhp\JsonFileManager;

// Initialize from a file path
$handler = new JsonFileManager('data.json', true);

// Get all data
$data = $handler->all();

// Get a value (dot notation supported)
$name = $handler->get('user.name');

// Set a value
$handler->set('user.age', 30);

// Append a value to an array
$handler->appendArray('tags', 'php');

// Remove a value from an array
$handler->removeArrayValue('tags', 'php');

// Remove where condition
$handler->removeWhere('users', function($user) {
    return $user['active'] === false;
});



// Save changes
$handler->save();

// You can load array data and save it to a json file.
$arr = [
     'numbers' => ['1', '2', '3']
];
$data = $handler->load($arr)->save(__DIR__ . 'test.json');

Main Methods

Method Description
all() Get all JSON data as an array.
get($key, $default = null) Get value by dot notation key.
set($key, $value) Set value at the given key.
remove($key) Remove an entry by dot notation key.
appendArray($key, $value, $unique = false) Append value to an array at key (optionally unique).
removeArrayValue($key, $value) Remove value from array at key.
removeWhere($key, $callback) Remove items from array at key matching callback.
save($jsonPath = "", $pretty = true) Save changes (pretty print by default).

Features

  • Dot notation for deeply nested keys.
  • Autosave option for automatic persistence.
  • Array manipulation helpers.
  • Fast in-memory operations with optional file persistence.
  • Flexible initialization (from file or array).

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固