PHPackages                             touki/populator - 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. touki/populator

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

touki/populator
===============

A simple Array-to-Object library

v1.0.0(12y ago)25552MITPHPPHP &gt;=5.3.2

Since Nov 15Pushed 12y agoCompare

[ Source](https://github.com/touki653/populator)[ Packagist](https://packagist.org/packages/touki/populator)[ RSS](/packages/touki-populator/feed)WikiDiscussions master Synced 3d ago

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

PHP Populator (Array-to-Object)
===============================

[](#php-populator-array-to-object)

[![Build Status](https://camo.githubusercontent.com/eb4ba19c002f09fde43f4724f025fed188e7e533ee2ede6cd6d5cf8ec5fd1fb3/68747470733a2f2f7472617669732d63692e6f72672f746f756b693635332f706f70756c61746f722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/touki653/populator)

PHP Populator is a simple Array-To-Object library which transforms arrays into a given object with a few additions with Annotations.
This is **not** a deserializer. If you're looking for a serializer/deserializer, I advise you to use [**jms/serializer**](https://github.com/schmittjoh/serializer).

The simple goal of this library is to use a lightweight (still object oriented) solution to hydrate an object from a given array without the overkill of a full serializer.
Plus, behaviour can be easily modified (decoupled), and it's unit tested!

\# Documentation Summary

- [Installation](#installation)
    - [Installation with composer](#installation-with-composer)
- [Setup](#setup)
    - [Basic Setup](#basic-setup)
    - [Advanced Setup](#advanced-setup)
- [Usage](#usage)
    - [Simple Usage](#simple-usage)
    - [Annotations](#annotations)
        - [@Populator\\Ignore](#populatorignore)
        - [@Populator\\Setter](#populatorsetter)
        - [@Populator\\Alias](#populatoralias)
        - [@Populator\\Aliases](#populatoraliases)
        - [@Populator\\Deep](#populatordeep)

Installation
============

[](#installation)

Installation with composer
--------------------------

[](#installation-with-composer)

The easiest way to use this library is to use [Composer](http://getcomposer.org)Just add the following lines into your `composer.json`

```
{
    "require": {
        "touki/populator": "~1.0.0"
    }
}
```

And run

```
composer update
```

Setup
=====

[](#setup)

Basic setup
-----------

[](#basic-setup)

This library uses the [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) autoloading mechanism, if you're using composer, there is nothing to do, the class should be autolaoded already.

In order to start using the populator, you just need to create an instance of it.

```

```

However if you're getting an error

> \[Semantical Error\] The annotation "..." does not exist, or could not be auto-loaded.

You should add the following lines at the top of your application.
This allows doctrine to know how to import your annotations from its own autoloader.

```
