PHPackages                             lukaszmakuch/haringo - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. lukaszmakuch/haringo

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

lukaszmakuch/haringo
====================

Serializes the way how an object is created, not the object itself.

v0.0.4(10y ago)0481MITPHP

Since Feb 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/lukaszmakuch/haringo)[ Packagist](https://packagist.org/packages/lukaszmakuch/haringo)[ RSS](/packages/lukaszmakuch-haringo/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (3)Versions (5)Used By (1)

Haringo
=======

[](#haringo)

Serialize the way how you create an object, not the object itself!

[![travis](https://camo.githubusercontent.com/5b508e237b04a33d094b5d3d1164f1428d7a68f8e7adf2ebdcd1ef39b5d3664d/68747470733a2f2f7472617669732d63692e6f72672f6c756b61737a6d616b7563682f686172696e676f2e737667)](https://travis-ci.org/lukaszmakuch/haringo)

What's Haringo?
---------------

[](#whats-haringo)

Haringo is a libary that aims to solve main problems with classical serialization:

- lost references which cause presence of \_\_wakeup() methods which use global variables
- data corruption after moving or renaming classes of serialized objects

### How's that achieved?

[](#hows-that-achieved)

#### No more \_\_wakeups!

[](#no-more-__wakeups)

Haringo allows to describe how an object should be built and then serialize that description instead of the created object. Thanks to this fact, any object built based on the serialized build plan doesn't need to know anything about things like global registry of resources or the current user session.

#### Freedom of renaming!

[](#freedom-of-renaming)

With Haringo you can make your serialized data totally free of things like:

- class paths
- method names
- parameter names

It's possible thanks to configurable map based sources and selectors.

Table of contents
-----------------

[](#table-of-contents)

1. [Getting Haringo](#installation)

- [Building Haringo](#building-haringo)
    - [Haringo builder](#getting-the-builder)
    - [Getting the basic Haringo](#getting-a-basic-haringo-instance)
    - [Maps](#setting-maps)
    - [Extensions](#extensions)
- [Using Haringo](#using-haringo)
    - [Build plans](#build-plans)
        - [New instance](#newinstancebuildplan)
        - [Static factory method product](#staticfactoryproductbuildplan)
        - [Factory object product](#factoryobjectproductbuildplan)
        - [Builder object product](#builderobjectproductbuildplan)
    - [Class path sources](#class-path-sources)
        - [Exact class path](#exactclasspath)
        - [Class path from a map](#classpathfrommap)
    - [Method selectors](#method-selectors)
        - [Constructor selector](#constructorselector)
        - [Method by exact name](#methodbyexactname)
        - [Method from a map](#methodfrommap)
    - [Parameter selectors](#parameter-selectors)
        - [Parameter by position](#parambyposition)
        - [Parameter by exact name](#parambyexactname)
        - [Parameter from a map](#paramfrommap)
    - [Value sources](#value-sources)
        - [Scalar](#scalarvalue)
        - [Array](#arrayvalue)
        - [Build plan result](#buildplanresultvalue)
    - [Working with build plans](#working-with-build-plans)
        - [Building objects](#building-objects-based-on-build-plans)
        - [Serialization](#serialization-of-build-plans)
        - [Fetching build plans by objects](#fetching-build-plans-by-built-objects)
- [Extending Haringo](#extend-haringo)

Installation
------------

[](#installation)

Use [composer](https://getcomposer.org) to get the latest version:

```
$ composer require lukaszmakuch/haringo

```

Building Haringo
----------------

[](#building-haringo)

To build Haringo, you can use the default implementation of the *\\lukaszmakuch\\Haringo\\Builder\\HaringoBuilder* interface.

### Getting the builder

[](#getting-the-builder)

```
