GithubHelp home page GithubHelp logo

protobuf-php / protobuf-plugin Goto Github PK

View Code? Open in Web Editor NEW
54.0 54.0 26.0 209 KB

PHP Code generator plugin from Google's Protocol Buffers

License: MIT License

Makefile 0.55% PHP 79.45% Smarty 19.80% Shell 0.20%

protobuf-plugin's People

Contributors

fabiobatsilva avatar partikus avatar rodrigodiez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

protobuf-plugin's Issues

[bug] .proto compile error

Error:

No syntax specified for the proto file: php.proto. Please use 'syntax = "proto2";' or 
'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
$ php ./vendor/bin/protobuf --include-descriptors --include="./proto" --generate-imported --out="./src/AppleIworkProtos" ./proto/apple-iwork.proto

Protos repository

New release after #6 (Symfony components 3.0+)

Hi!

I'm starting to use your library with a Symfony 3 project. It seems that compatibility has been checked with the MR #6 (Add possibility to install newer version of components).

Do you have planned to create a new version / tag + packagist sync to use it?

Default values missing

Per this documentation: https://developers.google.com/protocol-buffers/docs/proto3#default fields are supposed to return their default value even if the parsed proto doesn't contain that value. Right now, I have to manually check for hasField() and implement the default value myself.

For example, check out FortType in this proto:
https://github.com/AeonLucid/POGOProtos/blob/master/src/POGOProtos/Map/Fort/FortData.proto
For FortType::GYM (0), my FortData proto doesn't contain any value on type, so getType() will return null, instead it should return FortType::GYM() (the first defined enum value).

Same thing for "owned_by_team": if it's 0, my proto doesn't contain data, and I have to manually check for hasOwnedbyTeam() and then assume 0 if it's missing, instead of just doing getOwnedByTeam()->value().

I shouldn't have to do this work myself judging from the specs.
Same thing applies to proto2: https://developers.google.com/protocol-buffers/docs/proto#optional

zendframework/zend-code is deprecated

Switch to https://github.com/laminas/laminas-code

Problems arise with code generation with PHP 7.4:

--php_out: protoc-gen-php: Plugin output is unparseable: \nWarning: \"continue\" targeting switch is equivalent to \"break\". Did you mean to use \"continue 2\"? in /Users/soulseekah/Development/wp-ipfs/php-libp2p/vendor/zendframework/zend-code/src/Generator/FileGenerator.php on line 135\n\nWarning: \"continue\" targeting switch is equivalent to \"break\". Did you mean to use \"continue 2\"? in /Users/soulseekah/Development/wp-ipfs/php-libp2p/vendor/zendframework/zend-code/src/Generator/FileGenerator.php on line 138\n\nWarning: \"continue\" targeting switch is equivalent to \"break\".

This was fixed in laminas. https://github.com/laminas/laminas-code/blob/4.5.x/src/Generator/FileGenerator.php#L84

Symfony 4/5 support

I'd like to use this within the latest symfony skeleton but this project only supports up to symfony 3. Can you provide a symfony 4+ version?

not working under Windows?

Hi,

i have installed all dependencies and packages as described (i can call php and protoc from commandline; installed all scripts via composer, ...)

But when i call
php .\vendor\bin\protobuf.bat --include-descriptors -i . -o ./src/ ./addressbook.proto
i only get the content of the bat-file in the console:

@ECHO OFF
SET BIN_TARGET=%~dp0/../protobuf-php/protobuf-plugin/bin/protobuf
php "%BIN_TARGET%" %*

What iam doing wrong?

Could not open input file: ./vendor/bin/protobuf

I'm trying to generate php code for a particular .proto file following instructions from the README.
I did the following in an empty directory with addressbook.proto :

brew install php composer protoc
composer require "protobuf-php/protobuf-plugin
php ./vendor/bin/protobuf --include-descriptors -i . -o ./src/ ./addressbook.proto

I get error saying:

Could not open input file: ./vendor/bin/protobuf

In vendor/ there is only the following folders:

autoload.php  composer/  protobuf-php/

What am I missing?

Info:

$ protoc --version
libprotoc 3.2.0
$ composer --version
Composer version 1.3.2 2017-01-27 18:23:41
$ php --version
PHP 7.1.2 (cli) (built: Feb 17 2017 10:51:21) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.