{"id":21688447,"url":"https://github.com/partikus/php-protobuf-encoder","last_synced_at":"2025-04-12T09:21:07.872Z","repository":{"id":57036075,"uuid":"83161515","full_name":"partikus/php-protobuf-encoder","owner":"partikus","description":"PHP Protbuf Encode library.","archived":false,"fork":false,"pushed_at":"2018-09-05T06:42:56.000Z","size":10,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T04:21:24.320Z","etag":null,"topics":["encoder","library","php","php7","protobuf","protobuf3"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/partikus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-25T20:45:02.000Z","updated_at":"2018-11-23T07:37:00.000Z","dependencies_parsed_at":"2022-08-23T21:00:11.464Z","dependency_job_id":null,"html_url":"https://github.com/partikus/php-protobuf-encoder","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/partikus%2Fphp-protobuf-encoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/partikus%2Fphp-protobuf-encoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/partikus%2Fphp-protobuf-encoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/partikus%2Fphp-protobuf-encoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/partikus","download_url":"https://codeload.github.com/partikus/php-protobuf-encoder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248544036,"owners_count":21121879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encoder","library","php","php7","protobuf","protobuf3"],"created_at":"2024-11-25T17:15:07.942Z","updated_at":"2025-04-12T09:21:07.842Z","avatar_url":"https://github.com/partikus.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PHP Protbuf Encode\n==================\n\n[![Build Status](https://travis-ci.org/partikus/php-protobuf-encoder.svg?branch=master)](https://travis-ci.org/partikus/php-protobuf-encoder)\n\nSimple PHP library that allows you encode Protobuf Message to byte code. Additionally this library allows to encode/decode massage into single message.\nThe implementation is based on [this article](http://eli.thegreenplace.net/2011/08/02/length-prefix-framing-for-protocol-buffers).\n  \n## How to use it?\n\n### Prepare Proto Message file\n\n```\nsyntax = \"proto3\";\n\npackage Your.Namespace;\n\nmessage DummyMessage {\n    string Title = 1;\n    string Description = 2;\n    string CreatedAt = 3;\n    string UpdatedAt = 4;\n}\n\n```\n\n### Generate PHP files\n\n```\nvendor/bin/protobuf --include-descriptors -i . -o src/ DummyMessage.proto\n```\n\n### Create PHP objects\n \n```\n$dummyMessage = Your\\Namespace\\DummyMessage::fromArray([\n    'Title' =\u003e 'Test 123',\n    'Description' =\u003e 'Description from the text',\n    'CreatedAt' =\u003e '2016-12-12 12:00:00',\n    'UpdatedAt' =\u003e '2016-12-12 13:00:00',\n]);\n\n$encoder = new ClearCode\\Protobuf\\ByteEncoder();\n/** @var \\Protobuf\\Stream $stream */\n$stream = $encoder-\u003eencode($dummyMessage);\nfile_put_contents(__DIR__ . '/dummyMessage.pb.bin', $stream);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpartikus%2Fphp-protobuf-encoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpartikus%2Fphp-protobuf-encoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpartikus%2Fphp-protobuf-encoder/lists"}