Giter Site home page Giter Site logo

tsantos84 / serializer Goto Github PK

View Code? Open in Web Editor NEW
28.0 5.0 1.0 574 KB

A PHP serialization component focused on performance

Home Page: https://tsantos-serializer.readthedocs.io/

License: MIT License

PHP 100.00%
php7 php-library serialization-library data-transformation

serializer's Introduction

TSantos Serializer

Build Status Quality Gate Status Coverage Latest Stable Version Total Downloads Latest Unstable Version License composer.lock available

TSantos Serializer is a library to encode/decode PHP objects to some string representation. Because of its exclusive serialization strategy, this library is the faster serialization component to PHP.

Instalation

You can install this library through composer:

composer require tsantos/serializer

or just add tsantos/serializer to your composer file and then

composer update

Usage

The best way to get start with TSantos Serializer is by using the builder. With a few configurations you are ready to serialize your data:

use TSantos\Serializer\SerializerBuilder;

class Post {
    public $title;
    public $summary;
}

$serializer = (new SerializerBuilder())
    ->setHydratorDir('/path/to/generated/hydrators')
    ->build();

$person = new Post('Post title', 'Post summary');

echo $serializer->serialize($person); // {"title":"Post title", "summary":"Post summary"}

This is the simplest example to get you started with TSantos Serializer. There are a lot of capabilities which you should know in order to master your serializer instance and take advantage of all library's power.

Features

Main features currently supported by TSantos Serializer:

  • No need to mapping classes for simple use cases ...
  • ... but supports YAML, XML and Annotations mapping formats for advanced mapping
  • Supports JSON encoders
  • (De-)serializes objects of any depth
  • Virtual properties
  • Properties grouping
  • Event listeners to hook into serialization operations
  • (De-)serializes interfaces and abstract classes

Documentation

Please refer to the documentation page to see all allowed configurations.

Licence

MIT

Tests

vendor/bin/phpunit -c phpunit.xml.dist

serializer's People

Contributors

tsantos84 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

naroga

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.