2017 © Pedro Peláez
 

typo3-flow-package serializer

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

image

ttree/serializer

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

  • Friday, September 18, 2015
  • by ttree
  • Repository
  • 2 Watchers
  • 0 Stars
  • 135 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Ttree.Serializer - Package for TYPO3 Flow to convert PHP object to and from JSON

Build Status Total Downloads, (*1)

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., (*2)

Usage

Use DI to inject the Ttree\Serializer\SerializerInterface where you need it:, (*3)

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., (*4)

You can skip any property by using the Ttree\Serializer\Annotations\Skip., (*5)

Functional Programming

You can also use directly the objects Ttree\Serializer\Json\Serialize and Ttree\Serializer\Json\Serialize in a functionnal style programming:, (*6)

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

The Versions

18/09 2015

dev-master

9999999-dev

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

  Sources   Download

LGPL-3.0+

The Requires

 

07/11 2014

1.0.1

1.0.1.0

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

  Sources   Download

LGPL-3.0+

The Requires

 

07/11 2014

1.0.0

1.0.0.0

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

  Sources   Download

LGPL-3.0+

The Requires