承接 wizbii/json-serializer 相关项目开发

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

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

wizbii/json-serializer

最新稳定版本:1.5.0

Composer 安装命令:

composer require wizbii/json-serializer

包简介

无描述信息

README 文档

README

pipeline status coverage report

Objectives

This package aims to help you serialize and deserialize objects into JSON with maximum performances. To do so, no reflection is used and the developer must implement 2 methods for each objects. It depends on php 7.4+ and Symfony 5.0+

Installation

composer require wizbii/json-serializer-bundle

Usage

First, create an object that implement ArraySerializable interface:

use Wizbii\JsonSerializerBundle\ArraySerializable; class SimpleSerializableObject implements ArraySerializable { private string $foo; public function serialize(): array { return [ 'foo' => $this->foo, ]; } public static function deserialize(array $contentAsArray) { return (new SimpleSerializableObject())->setFoo($contentAsArray['foo'] ?? ''); } public function getFoo(): string { return $this->foo; } public function setFoo(string $foo): SimpleSerializableObject { $this->foo = $foo; return $this; } } 

Then, use the Serializer service to (de)serialize it:

class MyController { private Serializer $serializer; public function __construct(Serializer $serializer) { $this->serializer = $serializer; } public function getSimpleObjectAction() { $simpleObject = (new SimpleObject())->setFoo('bar'); return new Response($this->serializer->serialize($simpleObject)); } public function getFoo() { $content = '{"foo":"bar"}'; $simpleObject = $this->serializer->deserialize($content, SimpleObject::class); return new Response($simpleObject->getFoo()); } } 

Contribute

  1. Fork the repository
  2. Make your changes
  3. Test them with composer dev:checks (it will run test, phpstan and cs:lint subcommands)
  4. Create a Merge Request

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固