PHP code example of mennovanhout / laravel-jms

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

    

mennovanhout / laravel-jms example snippets


use JMS\Serializer\Annotation as Serializer;

class PaymentDTO
{
    /**
     * @Serializer\SerializedName("title")
     * @Serializer\Type("string")
     *
     * @var string
     */
    private $title;

    /**
     * @return string
     */
    public function getTitle(): string
    {
        return $this->title;
    }
}

$serializer = app(Serializer::class);

/** @var PaymentDTO */
$paymentDTO = $serializer->deserialize($json, PaymentDTO::class, 'json');

$serializer = app(Serializer::class);

$json = $serializer->serialize($paymentDTO, 'json');