PHP code example of partikus / protobuf-encoder
1. Go to this page and download the library: Download partikus/protobuf-encoder 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/ */
partikus / protobuf-encoder example snippets
$dummyMessage = Your\Namespace\DummyMessage::fromArray([
'Title' => 'Test 123',
'Description' => 'Description from the text',
'CreatedAt' => '2016-12-12 12:00:00',
'UpdatedAt' => '2016-12-12 13:00:00',
]);
$encoder = new ClearCode\Protobuf\ByteEncoder();
/** @var \Protobuf\Stream $stream */
$stream = $encoder->encode($dummyMessage);
file_put_contents(__DIR__ . '/dummyMessage.pb.bin', $stream);