Giter Site home page Giter Site logo

Comments (3)

hjagodzinski avatar hjagodzinski commented on July 17, 2024

The php-protobuf comes with a custom made proto parser which supports only a subset of proto syntax - this is why you're getting this informative error. If you would like to you can try out a work in progress branch https://github.com/allegro/php-protobuf/tree/plugin. It uses original protoc compiler. You run it as follows:

php protoc-php-gen.php gtfs-realtime-proto.proto (Run with --help argument to see more options available.)

Run "composer install" before running this commnad in order to have all dependencies installed.

Generated classes are PSR-0 compliant. The option that might interest you is -Dnamespace that allows you to define a namespace to put your classes into:

php protoc-php-gen.php -Dnamespace=Foo\Bar gtfs-realtime-proto.proto

If you try it can you let me know how it worked for you?

from php-protobuf.

brians-code avatar brians-code commented on July 17, 2024

It worked great, thanks! The only change I had to make was adding quotes to the -D parameter

php protoc-php-gen.php -Dnamespace="Foo\Bar" gtfs-realtime-proto.proto

Otherwise it would concat the namespace and sub-namespace into one word.

You are doing some really interesting work. I like how you structured this as an official plugin to protoc, and are modeling Google's class structure for other generated languages. Who knows when Google will get around to adding a native PHP class generator, and the classes are unlikely to be structured as well as these are. You should reach out to Google and get them to throw some money at you!

from php-protobuf.

hjagodzinski avatar hjagodzinski commented on July 17, 2024

Great it worked for you! I'm glad you like it, thanks πŸ˜‰

from php-protobuf.

Related Issues (20)

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.