{"id":19591355,"url":"https://github.com/taoso/protoc-gen-grpc-php","last_synced_at":"2025-12-16T00:28:33.407Z","repository":{"id":57649980,"uuid":"115909004","full_name":"taoso/protoc-gen-grpc-php","owner":"taoso","description":"protoc grpc plugin for PHP","archived":false,"fork":false,"pushed_at":"2019-04-16T14:41:06.000Z","size":53,"stargazers_count":27,"open_issues_count":0,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T00:41:16.379Z","etag":null,"topics":["grpc","grpc-php","protoc-grpc-plugin"],"latest_commit_sha":null,"homepage":null,"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/taoso.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":"2018-01-01T09:00:27.000Z","updated_at":"2024-09-09T15:28:24.000Z","dependencies_parsed_at":"2022-09-05T13:41:21.756Z","dependency_job_id":null,"html_url":"https://github.com/taoso/protoc-gen-grpc-php","commit_stats":null,"previous_names":["lvht/protoc-gen-grpc-php"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoso%2Fprotoc-gen-grpc-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoso%2Fprotoc-gen-grpc-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoso%2Fprotoc-gen-grpc-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoso%2Fprotoc-gen-grpc-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taoso","download_url":"https://codeload.github.com/taoso/protoc-gen-grpc-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251145584,"owners_count":21543069,"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":["grpc","grpc-php","protoc-grpc-plugin"],"created_at":"2024-11-11T08:28:40.243Z","updated_at":"2025-12-16T00:28:33.341Z","avatar_url":"https://github.com/taoso.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protoc-gen-grpc-php\n\ngRPC plugin and sdk for php.\n\n## Installation\n\n    composer require lvht/grpc\n\n## Generate PHP SDK\n\nrun the following command to generate php sdk for helloworld.proto\n\n    protoc --php_out=out --grpc-php_out=composer_name=grpc/hello:out \\\n        --plugin=protoc-gen-grpc-php=./vendor/bin/protoc-gen-grpc-php \\\n        ./helloworld.proto\n\nyou will get\n\n```\nout\n├── composer.json                   -- make sdk as a composer package\n├── GPBMetadata\n│   └── Helloworld.php\n└── Helloworld\n    ├── GreeterService.php          -- php interface for service\n    ├── GreeterServiceTrait.php     -- generated service helper code\n    ├── GreeterServiceStub.php      -- generated service stub code\n    ├── HelloReply.php              -- message class generated by protoc\n    └── HelloRequest.php            -- message class generated by protoc\n```\n\nFor **XXX** service define in proto, you will get a `XXX` interface. The `XXX`\ninterface has one implementation, `XXXServiceStub` for client side. And you\nneed develop your own server side implementation using the `XXXServerTrait`.\n\nPlease see the `example/client.php` and `example/server.php` for more detail.\n\n## Arguments\n\nprotoc-gen-grpc-php offer some arguments.\n\n* composer_name set the generated code's package name\n* stub_trait add additional trait to the generated stub\n* stub_trait_only replace the default trait of the generated stub\n\n## Simple gRPC\n\nBesides the standard gRPC, the generated code has two additional features.\n\n### gRPC over http/1.1\n\nSet the `use_http1` flag to `true` when you create a stub instance will let stub use http1.1 to transfer rpc data. Both `grpc-status` and `grpc-message` will be transfered as a normal http header instead of **Trailers**.\n\n### simple gRPC or sRPC\n\nSet the `Content-Type` to `application/json` will let stub use a more simple mode to transfer rpc data. In the simple mode, only json is supported, and the message prefix must not be transfered. Both http/1 and http/2 are supported.\n\n```\nPOST /helloworld.Greeter/SayHello HTTP/1.1\nAccept: application/json, */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nContent-Length: 24\nContent-Type: application/json\nHost: localhost:8080\nUser-Agent: HTTPie/0.9.9\nfoo: bar\n\n{\n    \"name\": \"海涛\"\n}\n\nHTTP/1.1 200 OK\nConnection: keep-alive\nContent-Length: 26\nDate: Sat, 24 Feb 2018 08:09:20 GMT\nServer: swoole-http-server\nb-bin: 5L2g5aW9\ncontent-type: application/json\ngrpc-status: 0\n\n{\n    \"message\": \"Hello 海涛\"\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaoso%2Fprotoc-gen-grpc-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaoso%2Fprotoc-gen-grpc-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaoso%2Fprotoc-gen-grpc-php/lists"}