定制 ttree/serializer 二次开发

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

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

ttree/serializer

最新稳定版本:1.0.1

Composer 安装命令:

composer require ttree/serializer

包简介

Package for TYPO3 Flow to convert PHP object to and from JSON

README 文档

README

Build Status Total Downloads

This package can be used to convert PHP object to and from JSON. The current version support object tree, but no circular references, as there is no way to represent this kind of reference in a JSON file.

Usage

Use DI to inject the Ttree\Serializer\SerializerInterface where you need it:

class ObjectUtility {

	/**
	 * @Flow\Inject
	 * @var \Ttree\Serializer\SerializerInterface
	 */
	protected $serializer;

	/**
	 * @param object $object
	 * @return string
	 */
	public function save($object) {
		$json = $this->serializer->serialize($object);
	}
	
	/**
	 * @param string $string
	 * @return object
	 */
	public function load($string) {
		$json = $this->serializer->unserialize($string);
	}

}

Skip property

The serializer will only include gettable properties. Transient property in a Doctrine entity are skipped automaticaly.

You can skip any property by using the Ttree\Serializer\Annotations\Skip.

Functional Programming

You can also use directly the objects Ttree\Serializer\Json\Serialize and Ttree\Serializer\Json\Serialize in a functionnal style programming:

$serialize = new Serialize();
$json = $serialize(array('Hello', 'World'));
$unserialize = new Unserialize();
$array = $unserialize('["Hello","World"]')

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2014-11-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固