2017 © Pedro Peláez
 

library mapper

A PHP5.5+ mapper to convert array of data into nested PHP objects

image

kokoroe/mapper

A PHP5.5+ mapper to convert array of data into nested PHP objects

  • Monday, August 8, 2016
  • by euskadi31
  • Repository
  • 1 Watchers
  • 0 Stars
  • 22 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Mapper PHP

Build Status SensioLabs Insight Coveralls HHVM Packagist, (*1)

Install

Add kokoroe/mapper to your composer.json:, (*2)

% php composer.phar require kokoroe/mapper:~1.0

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

class Article
{
    protected $title;

    protected $content;

    protected $author;

    protected $tags = [];

    public function setTitle($title)
    {
        $this->title = $title;
    }

    public function setContent($content)
    {
        $this->content = $content;
    }

    public function setAuthor(User $author)
    {
        $this->author = $author;
    }

    public function setTags(array $tags)
    {
        $this->tags = $tags;
    }
}

class User
{
    protected $id;

    protected $name;

    public function setId($id)
    {
        $this->id = $id;
    }

    public function setName($name)
    {
        $this->name = $name;
    }
}


$article = Mapper::hydrate([
    'title' => 'test',
    'content' => 'foo',
    'author' => [
        'id' => 1,
        'name' => 'Axel'
    ],
    'tags' => ['test', 'mapping']
], Article::class);

var_dump($article);

License

mapper-php is licensed under the MIT license., (*3)

The Versions

08/08 2016

dev-master

9999999-dev

A PHP5.5+ mapper to convert array of data into nested PHP objects

  Sources   Download

MIT

The Development Requires

08/08 2016

v1.0.3

1.0.3.0

A PHP5.5+ mapper to convert array of data into nested PHP objects

  Sources   Download

MIT

The Development Requires

26/07 2016

v1.0.2

1.0.2.0

A PHP5.5+ mapper to convert array of data into nested PHP objects

  Sources   Download

MIT

The Development Requires

26/07 2016

v1.0.1

1.0.1.0

A PHP5.5+ mapper to convert array of data into nested PHP objects

  Sources   Download

MIT

The Development Requires

26/07 2016

v1.0.0

1.0.0.0

A PHP5.5+ mapper to convert array of data into nested PHP objects

  Sources   Download

MIT

The Development Requires