PHPackages                             sparkcentral/marshaller - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sparkcentral/marshaller

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sparkcentral/marshaller
=======================

Generic marshalling component. Provides functionality to transform data from one form to another and vice versa.

0.x-dev(10y ago)03.0kMITPHPPHP &gt;=5.6.0

Since Aug 4Pushed 10y ago4 watchersCompare

[ Source](https://github.com/sparkcentral/marshaller)[ Packagist](https://packagist.org/packages/sparkcentral/marshaller)[ RSS](/packages/sparkcentral-marshaller/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Marshaller
==========

[](#marshaller)

Generic marshalling component. Provides functionality to transform data from one form to another and vice versa.

[![Build Status](https://camo.githubusercontent.com/76d4e9f77dc843b19f6d6013bfd7f4c2f5e4831e7673b14db3691334b0f7af08/68747470733a2f2f7472617669732d63692e6f72672f737061726b63656e7472616c2f6d61727368616c6c65722e737667)](https://travis-ci.org/sparkcentral/marshaller)

There are many use cases where marshalling can be useful. Most of them though would be about taking snapshot of all properties of an object and sending it to some external system (database for persistence or browser as body of HTTP response).

Usually this "source" data can not be send "as is" and needs to be transformed. In very simple case: your object properties may be named in "camelCase" style and your database table field names are "underscore\_separated". In practice there are many more reasons for such or similar transformations.

**Marshaller** provides simple framework for transforming data back and forth between "source" and "destination" formats.

Features
--------

[](#features)

- Supports transformations in both directions (marshalling/unmarshalling)
- Flexible definition of schema with rules for data transformation
- Support for different input and output formats. Built-in support for arrays and `stdClass` objects.

Dependencies
------------

[](#dependencies)

- PHP &gt;= 5.6.0

Basic example
-------------

[](#basic-example)

```
