1. Go to this page and download the library: Download sparhandy/avro-php 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/ */
sparhandy / avro-php example snippets
use Avro\DataIO\DataIO;
use Avro\DataIO\DataIOReader;
use Avro\DataIO\DataIOWriter;
use Avro\Datum\IODatumReader;
use Avro\Datum\IODatumWriter;
use Avro\IO\StringIO;
use Avro\Schema\Schema;
jose = array('member_id' => 1392, 'member_name' => 'Jose');
$maria = array('member_id' => 1642, 'member_name' => 'Maria');
$data = array($jose, $maria);
$file_name = 'data.avr';
// Open $file_name for writing, using the given writer's schema
$data_writer = DataIO::open_file($file_name, 'w', $writers_schema_json);
// Write each datum to the file
foreach ($data as $datum) {
$data_writer->append($datum);
}
$data_writer->close();
// Open $file_name (by default for reading) using the writer's schema
// ar_export($datum, true) . "\n";
}
bash
$ composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.