PHP code example of sidus / base-serializer-bundle

1. Go to this page and download the library: Download sidus/base-serializer-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sidus / base-serializer-bundle example snippets




namespace FooBar\Model;

use Sidus\BaseSerializerBundle\Serializer\Annotation\NestedClass;
use Sidus\BaseSerializerBundle\Serializer\Annotation\NestedPropertyDenormalizer;

/**
 * @NestedPropertyDenormalizer()
 */
class Book
{
    /** @var string */
    protected $id;
    
    /**
     * @var \DateTimeInterface|null
     *
     * @NestedClass(targetClass="DateTime")
     */
    protected $publicationDate;
    
    /**
     * @var Author|null
     *
     * @NestedClass(targetClass="FooBar\Model\Author")
     */
    protected $author;

    /**
     * @var Edition[]
     *
     * @NestedClass(targetClass="FooBar\Model\Edition", multiple=true)
     */
    protected $editions = [];
    
    // Here be getters (no setters needed)
}