jojo1981/jms-serializer-handlers 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

jojo1981/jms-serializer-handlers

最新稳定版本:6.1.0

Composer 安装命令:

composer require jojo1981/jms-serializer-handlers

包简介

Handlers for the JMS Serializer

README 文档

README

Build Status Coverage Status Latest Stable Version Total Downloads License

Author: Joost Nijhuis <jnijhuis81@gmail.com>

This library is an extension for the jms/serializer package and contains custom handlers which add support to work with some 3th party libraries. More information about JMS Serializer Handlers can be found here.

This library adds support for:

  • instances of Jojo1981\TypedCollection\Collection from the package jojo1981/typed-collection.

Installation

Library

git clone https://github.com/jojo1981/jms-serializer-handlers.git

Composer

Install PHP Composer

composer require jojo1981/jms-serializer-handlers

Usage

<?php use JMS\Serializer\Accessor\DefaultAccessorStrategy; use JMS\Serializer\Construction\UnserializeObjectConstructor; use JMS\Serializer\Handler\HandlerRegistry; use JMS\Serializer\Naming\CamelCaseNamingStrategy; use JMS\Serializer\Naming\SerializedNameAnnotationStrategy; use JMS\Serializer\SerializerBuilder; use Jojo1981\JmsSerializerHandlers\TypedCollectionAccessorStrategyDecorator; use Jojo1981\JmsSerializerHandlers\TypedCollectionObjectConstructorDecorator; use Jojo1981\JmsSerializerHandlers\TypedCollectionSerializationHandler; use Jojo1981\JmsSerializerHandlers\TypedSetSerializationHandler; use Jojo1981\JmsSerializerHandlers\UnionSerializationHandler; require 'vendor/autoload.php'; $propertyNamingStrategy = new SerializedNameAnnotationStrategy(new CamelCaseNamingStrategy()); $accessorStrategy = new TypedCollectionAccessorStrategyDecorator(new DefaultAccessorStrategy()); $serializer = (new SerializerBuilder()) ->setDebug(true) ->setCacheDir(__DIR__ . '/var/cache/serializer') ->setAccessorStrategy($accessorStrategy) ->setPropertyNamingStrategy($propertyNamingStrategy) ->addDefaultHandlers() ->configureHandlers(static function (HandlerRegistry $handlerRegistry): void { $handlerRegistry->registerSubscribingHandler(new TypedCollectionSerializationHandler()); $handlerRegistry->registerSubscribingHandler(new TypedSetSerializationHandler()); $handlerRegistry->registerSubscribingHandler(new UnionSerializationHandler()); }) ->setObjectConstructor(new TypedCollectionObjectConstructorDecorator(new UnserializeObjectConstructor())) ->build();

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固