allegro / php-protobuf

PHP Protobuf - Google's Protocol Buffers for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate php file under PSR-0 Namespace Autoloading convention

lulyon opened this issue · comments

Currently protocol file generates a single php file no matter how many messages there are.

Therefore the generated php file is not under PSR-0 Namespace Autoloading, which is a great feature after php 5.3 for conveniently manage php classes.

It would be very programmer-friendly if the generate php files are:

  • under the same folder
  • filename is consistent with class name
  • correspondent (semantically) to a single message of each protocol file.

You can pass two command line options to protoc-php compiler: -n --psr in order to have what you want. I'm working currently on plugin for a protoc compiler which will solve parsing issues which are ones most often reported. Along with this change I would like to make PSR-0 the only way to generate PHP classes.

@hjagodzinski great ! looking forward to that !