PHP code example of jobcloud / avro-validator

1. Go to this page and download the library: Download jobcloud/avro-validator 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/ */

    

jobcloud / avro-validator example snippets


$recordRegistry = RecordRegistry::fromSchema(file_get_contents(__DIR__ . '/schema.json'));
$validator = new Validator($recordRegistry);

var_dump($validator->validate(
    '{"payload": "here comes the payload to validate against the schema"}}',
    'marketplace.ecommerce.entity.order'
));