New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
php namespace support for GPBMetadata #3970
Comments
I see this is a problem. The current namespace of GPBMetatdata file is related to the place of proto file, e.g., foo/bar.proto will become GPBMetadata/Foo/Bar.php |
Is --proto_path=first/ required? If it is removed, you can get GPBMetadata\First\User.php |
The import in your proto file may need to be changed accordingly. |
Ok, I tried second option, it works fine. thank you. @TeBoring The remain problem is the namespace of GPBMetadata is not the same with the stub class. For example. stub class namespace is "FirstService\User.php", but GPBMetadata is "GPBMetadata\FirstService\User.php". It's better if is "FirstService\GPBMetadata\User.php". |
And for psr-4 autoload, namespace like "FirstService\GPBMetadata\User.php" makes sense for create standalone library for other developer to import. |
+1 for this. |
+1. This issue affects our project too. It will be great if we can choose GPBMetadata's namespace. |
Looking forward to seeing this resolved, would hate to get collisions in any projects that rely on multiple PB-based implementations. The |
Separate note: It would also be nice if while all this was being done, |
I will add a file option to add GPBMetadata namespace. |
Can you follow community+PSR conventions and make it |
Added in #4622 |
🎉 |
#3162
As you said, these GPBMetadata files are transparent to users. But I think it still makes sense to add namespace for GPBMetadata file.
Suppose I have 2 grpc go services and are developed by different teams. They define the protobuf file by "user.proto". this "user.proto" will generate a GPBMetadata\User.php file.
My laravel project needs to use both two grpc services they provided and for the psr-4 autoload, the composer.json file needs to be defined as follows:
Executing "composer dumpautoload" in the root directory of project, and we will get notice like this:
So I think it makes sense to add GPBMetadata namespace support.
Looking forward to your reply.
ping @TeBoring
The text was updated successfully, but these errors were encountered: