2017 © Pedro Peláez
 

library breakfast-serializer

Library for (de-)serializing data of any complexity to JSON

image

brettminnie/breakfast-serializer

Library for (de-)serializing data of any complexity to JSON

  • Wednesday, March 30, 2016
  • by brettminnie
  • Repository
  • 3 Watchers
  • 2 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 4 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

breakfast-serializer

Build Status Scrutinizer Code Quality Dependency Status Coverage Status, (*1)

A replacement for the other well known serializer, initially we were aiming for backwards compatibility, however it seemed more appropriate to develop a lightweight alternative. We are forgoing the depth of features now to offer something that is easy to configure and works well without any configuration., (*2)

Installation

$ composer require brettminnie/breakfast-serializer:0.1.*, (*3)

Job done, start enjoying your morning serial!, (*4)

Configuration

Out the box will do a full depth/breadth recursion and serialize to JSON format, no config is required. It will always serialize with a variable called className attached to the object. This is a fully fledged namespace and is required to deserialize. If you want to deserialize from JSON data that is missing this variable it needs to be injected into the object., (*5)

Supported Serialization Formats

  • [x] JSON
  • [ ] XML
  • [ ] PHP Object Notation
  • [ ] YAML

Features

  • [x] Simple limiting of traversal depth
  • [x] Mapping of properties to alternate names and back again
  • [x] Excluding of properties from serialization and ignoring them on deserialization
  • [x] Simple YAML config format (Yay no slow php annotations!)

Quick and Dirty Example, (*6)


// To retrieve the json representation json of an object $jsonData = BDBStudios\BreakfastSerializer\SerializerFactory::getSerializer() ->serialize($myClass); // To unserialize $myClass = BDBStudios\BreakfastSerializer\SerializerFactory::getSerializer() ->deserialize($jsonData); //To serialize an object with a limited depth recursion (aka only some of it) $jsonData = BDBStudios\BreakfastSerializer\SerializerFactory::getSerializer( BDBStudios\BreakfastSerializer\IsSerializable::FORMAT_JSON, 2 ) ->serialize($myClass);

Further examples in the documentation directory., (*7)

The Versions

30/03 2016

dev-develop

dev-develop

Library for (de-)serializing data of any complexity to JSON

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brett Minnie

json xml serialization deserialization jaxb

26/07 2015

dev-master

9999999-dev

Library for (de-)serializing data of any complexity to JSON

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brett Minnie

json xml serialization deserialization jaxb

26/07 2015

0.1.0

0.1.0.0

Library for (de-)serializing data of any complexity to JSON

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brett Minnie

json xml serialization deserialization jaxb