PHP code example of wedocreatives / wrike-php-jmsserializer

1. Go to this page and download the library: Download wedocreatives/wrike-php-jmsserializer 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/ */

    

wedocreatives / wrike-php-jmsserializer example snippets


/**
 * Standard usage
 */
$serializer = SerializerFactory::create(); // \JMS\Serializer\SerializerInterface

$resourceModelTransformer = TransformerFactory::createResourceModelTransformer($serializer);

/**
 * @param ResponseInterface $response
 * @param string            $resourceClass
 *
 * @return ResourceModelInterface
 */
$result = $resourceModelTransformer->transform($response, $resourceClass);

$result => [
    <ResourceModelInterface>,
    <ResourceModelInterface>,
    ...
]

$responseModelTransformer = TransformerFactory::createResponseModelTransformer($serializer);

/**
 * @param ResponseInterface $response
 * @param string            $resourceClass
 *
 * @return ResponseModelInterface
 */
$result = $responseModelTransformer->transform($response, $resourceClass);

$result => ResponseModelInterface {
    kind: <ResponseType>;
    data:
        [
            <ResourceModelInterface>,
            <ResourceModelInterface>,
            ...
        ]
}
bash
git clone [email protected]:wedocreatives/wrike-php-jmsserializer.git
cd wrike-php-jmsserializer