2017 © Pedro Peláez
 

library jsonserializer

JSON Serializer implementation.

image

phpfluent/jsonserializer

JSON Serializer implementation.

  • Sunday, July 21, 2013
  • by kinncj
  • Repository
  • 2 Watchers
  • 5 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

JSONSerializer

JSON Serializer implementation. Build Status, (*1)

Install: shell composer.phar require phpfluent/jsonserializer:dev-master Usage: ```php <?php use PHPFluent\JSONSerializer\Serializer;, (*2)

class Nested extends Serializer { /** * @PHPFluent\JSONSerializer\Attribute */ private $array;, (*3)

public function setArray(array $array)
{
    $this->array = $array;

    return $this;
}

}, (*4)

class MyFancyClass extends Serializer { /** * @PHPFluent\JSONSerializer\Attribute */ private $email;, (*5)

/**
 * @PHPFluent\JSONSerializer\Attribute
 */
private $nested;

private $iWontBeSerialized;

public function setEmail($email)
{
    if ( ! filter_var($email, FILTER_VALIDATE_EMAIL)) {
        throw new \InvalidArgumentException("Invalid email");
    }

    $this->email = $email;

    return $this;
}

public function setNested(Nested $nested)
{
    $this->nested = $nested;

    return $this;
}

}, (*6)

$nested = (new Nested)->setArray(array(1, 2, 3)); $fancy = (new MyFancyClass)->setEmail("foo@bar.com")->setNested($nested);, (*7)

json_encode($fancy); /* $serialized = json_encode( (new MyFancyClass)->setEmail("foo@bar.com")->setNested( (new Nested)->setArray(array(1, 2, 3)) ); ); */, (*8)

```, (*9)

Test: shell cd phpfluent/jsonserializer composer.phar install --dev make test, (*10)

The Versions

21/07 2013

dev-master

9999999-dev http://github.com/PHPFluent/JSONSerializer

JSON Serializer implementation.

  Sources   Download

New BSD

The Requires

 

The Development Requires