定制 matraux/json-orm 二次开发

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

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

matraux/json-orm

Composer 安装命令:

composer require matraux/json-orm

包简介

A PHP 8.5+ library for converting JSON data to typed entities and back, with support for lazy-loading collections.

README 文档

README

Latest Version on Packagist License: MIT PHP Security Policy Contributing QA Status Issues Last Commit


Introduction

A PHP 8.5+ library for converting JSON data to typed entities and back, with support for lazy-loading collections, mutable data structures, and structured entity design. Useful for structured JSON APIs, configuration parsing, and object-based manipulation of hierarchical JSON data.


Features

  • Object-oriented JSON mapping
  • Conversion from JSON to typed entities and back
  • Lazy-loading collections for efficient memory usage
  • Entity objects are mutable and can be freely modified after creation
  • Strict type support with automatic casting and codec transformations
  • Native support for nested structures and arrays
  • Easy integration with configuration or API responses

Installation

composer require matraux/json-orm

PHP compatibility

This package provides separate major versions for different PHP baselines.

Version PHP
1.x 7.4+
2.x 8.3+
3.x 8.4+
4.x 8.5+

Examples

See Definitions for how to define your own entities and collections.

See Read for full reading examples.

use Matraux\JsonOrm\Json\SimpleExplorer;

// Load data from JSON string or file
$explorer = SimpleExplorer::fromString('[{"CUSTOM_ID":1,"name":"First"}]');

// Create typed collection from JSON
$collection = CommonCollection::fromExplorer($explorer);

$entity = $collection[0];
echo $entity->name; // "First"

See Write for writing examples.

// Create collection and insert entity
$collection = CommonCollection::create();

$entity = $collection->createEntity();
$entity->name = 'Example';

echo json_encode($collection);
// '[{"name":"Example"}]'

Development

See Development for debug, test instructions, static analysis, and coding standards.


Support

For bug reports and feature requests, please use the issue tracker.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固