PHP code example of weblabel / data-transformer

1. Go to this page and download the library: Download weblabel/data-transformer 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/ */

    

weblabel / data-transformer example snippets




declare(strict_types=1);

coder\JsonDecoder;
use Weblabel\DataTransformer\Resolver\DecoderResolver;

$decoders = [
    new JsonDecoder(),
];
$decoderResolver = new DecoderResolver($decoders);

$jsonDecoder = $decoderResolver->resolve('json');
$data = $jsonDecoder->decode('{"status":"ok"}');

// will return
// [
//   'status' => 'ok',
// ]