PHP code example of liip / serializer-jms-adapter

1. Go to this page and download the library: Download liip/serializer-jms-adapter 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/ */

    

liip / serializer-jms-adapter example snippets


use JMS\Serializer\Serializer as JMSSerializer;
use Liip\Serializer\Adapter\JMS\JMSSerializerAdapter;
use Liip\Serializer\Serializer as LiipSerializer;

// see https://github.com/liip/serializer/ for how to set up the Liip Serializer
$liipSerializer = new LiipSerializer(...);
// see https://jmsyst.com/libs/serializer for how to set up JMS Serializer
$jmsSerializer = new JMSSerializer(...);

$serializer = new JMSSerializerAdapter($liipSerializer, $jmsSerializer, new NullLogger());

// $serializer can now be used in place of $jmsSerializer

$enabledClasses = ['App\Model\Product', 'App\Model\Category'];

$serializer = new JMSSerializerAdapter($liipSerializer, $jmsSerializer, new NullLogger(), $enabledClasses);