Laravel 5.7 gRPC Integration





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I have setup gRPC in core PHP and it is working fine but I want to use it with laravel 5.7. I have downloaded gRPC using composer.json. Now I don't know what I have to do for using gRPC in it.



I have added below in my composer.json file



"require": {
"datto/protobuf-php": "dev-master",
"grpc/grpc": "^1.15.0"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/stanley-cheung/Protobuf-PHP"
}
]


But now I am not getting what should be next to do. So anyone knows then please let me know. I have my core PHP code for gRPC(core library example) which I have setup from this web url. gRPC in PHP. So I just want to integrate into laravel.










share|improve this question































    1















    I have setup gRPC in core PHP and it is working fine but I want to use it with laravel 5.7. I have downloaded gRPC using composer.json. Now I don't know what I have to do for using gRPC in it.



    I have added below in my composer.json file



    "require": {
    "datto/protobuf-php": "dev-master",
    "grpc/grpc": "^1.15.0"
    },
    "repositories": [
    {
    "type": "vcs",
    "url": "https://github.com/stanley-cheung/Protobuf-PHP"
    }
    ]


    But now I am not getting what should be next to do. So anyone knows then please let me know. I have my core PHP code for gRPC(core library example) which I have setup from this web url. gRPC in PHP. So I just want to integrate into laravel.










    share|improve this question



























      1












      1








      1








      I have setup gRPC in core PHP and it is working fine but I want to use it with laravel 5.7. I have downloaded gRPC using composer.json. Now I don't know what I have to do for using gRPC in it.



      I have added below in my composer.json file



      "require": {
      "datto/protobuf-php": "dev-master",
      "grpc/grpc": "^1.15.0"
      },
      "repositories": [
      {
      "type": "vcs",
      "url": "https://github.com/stanley-cheung/Protobuf-PHP"
      }
      ]


      But now I am not getting what should be next to do. So anyone knows then please let me know. I have my core PHP code for gRPC(core library example) which I have setup from this web url. gRPC in PHP. So I just want to integrate into laravel.










      share|improve this question
















      I have setup gRPC in core PHP and it is working fine but I want to use it with laravel 5.7. I have downloaded gRPC using composer.json. Now I don't know what I have to do for using gRPC in it.



      I have added below in my composer.json file



      "require": {
      "datto/protobuf-php": "dev-master",
      "grpc/grpc": "^1.15.0"
      },
      "repositories": [
      {
      "type": "vcs",
      "url": "https://github.com/stanley-cheung/Protobuf-PHP"
      }
      ]


      But now I am not getting what should be next to do. So anyone knows then please let me know. I have my core PHP code for gRPC(core library example) which I have setup from this web url. gRPC in PHP. So I just want to integrate into laravel.







      php laravel-5 grpc






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 16 at 8:06









      piet.t

      10.1k73246




      10.1k73246










      asked Jan 3 at 5:05









      YogendrasinhYogendrasinh

      612318




      612318
























          2 Answers
          2






          active

          oldest

          votes


















          0














          you don't need these anymore



          "datto/protobuf-php": "dev-master",

          "repositories": [
          {
          "type": "vcs",
          "url": "https://github.com/stanley-cheung/Protobuf-PHP"
          }
          ]


          Instead, you should add "google/protobuf": "^3.6.1" to your require.



          See this as an example:



          https://github.com/grpc/grpc/blob/master/examples/php/composer.json



          The versions were out-of-date - just take the latest releases.






          share|improve this answer
























          • I have replaced datto/protobuf-php to google/protobuf": "^3.6.1. But i don't know what should i do configure gRPC in laravel.

            – Yogendrasinh
            Jan 18 at 4:03











          • after adding this line "google/protobuf": "^3.6.1" any errors you got while installing dependency ?

            – Mehul Kuriya
            Jan 28 at 11:31



















          0














          Edit: I think i managed to solve the problem



          How to use protoc generated files with Laravel (5.7)




          • Prepare your .proto file describing your services as you would normally do

          • Set as package name package app.grpc;

          • Run the generation command: protoc --php_out=./ --grpc_out=./ --plugin=protoc-gen-grpc=/your/path/to/grpc_php_plugin yourfile.proto

          • Now copy App/Grpc inside laravel App

          • Copy GPBMetadata folder as new folder in laravel root

          • Change composer.json file inserting "GPBMetadata" in the autoload classmap section (where there are also database seeds and factories)

          • Run command composer dump-autoload

          • Now you can use your generated classes in any controller, remember to add "use AppGrpcYourClassName" at the top.


          Useful screenshots:



          composer.json file



          let me know if someone have better solutions to this





          I'm having the same problem too.



          First you need to generate PHP classes with Protoc, but then I don't know where to place those classes.



          protoc generates two namespaces "GPBMetadata" and "YourService"



          now, if I copy those two folders inside the App then the namespace will not match laravel folder schema and it will not works but at the same time we cannot change the namespace manually in the generated files otherwise it will not match the descriptor pool and will result in error



          So the solution could be to place the two classes in the root of laravel and modify the composer autoload, but i'm pretty sure this is not the right way to do it.



          Someone have any idea?









          share|improve this answer


























          • This does not provide an answer to the question. You can search for similar questions, or refer to the related and linked questions on the right-hand side of the page to find an answer. If you have a related but different question, ask a new question, and include a link to this one to help provide context. See: Ask questions, get answers, no distractions

            – Zoe
            Jan 19 at 10:01












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54016622%2flaravel-5-7-grpc-integration%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          you don't need these anymore



          "datto/protobuf-php": "dev-master",

          "repositories": [
          {
          "type": "vcs",
          "url": "https://github.com/stanley-cheung/Protobuf-PHP"
          }
          ]


          Instead, you should add "google/protobuf": "^3.6.1" to your require.



          See this as an example:



          https://github.com/grpc/grpc/blob/master/examples/php/composer.json



          The versions were out-of-date - just take the latest releases.






          share|improve this answer
























          • I have replaced datto/protobuf-php to google/protobuf": "^3.6.1. But i don't know what should i do configure gRPC in laravel.

            – Yogendrasinh
            Jan 18 at 4:03











          • after adding this line "google/protobuf": "^3.6.1" any errors you got while installing dependency ?

            – Mehul Kuriya
            Jan 28 at 11:31
















          0














          you don't need these anymore



          "datto/protobuf-php": "dev-master",

          "repositories": [
          {
          "type": "vcs",
          "url": "https://github.com/stanley-cheung/Protobuf-PHP"
          }
          ]


          Instead, you should add "google/protobuf": "^3.6.1" to your require.



          See this as an example:



          https://github.com/grpc/grpc/blob/master/examples/php/composer.json



          The versions were out-of-date - just take the latest releases.






          share|improve this answer
























          • I have replaced datto/protobuf-php to google/protobuf": "^3.6.1. But i don't know what should i do configure gRPC in laravel.

            – Yogendrasinh
            Jan 18 at 4:03











          • after adding this line "google/protobuf": "^3.6.1" any errors you got while installing dependency ?

            – Mehul Kuriya
            Jan 28 at 11:31














          0












          0








          0







          you don't need these anymore



          "datto/protobuf-php": "dev-master",

          "repositories": [
          {
          "type": "vcs",
          "url": "https://github.com/stanley-cheung/Protobuf-PHP"
          }
          ]


          Instead, you should add "google/protobuf": "^3.6.1" to your require.



          See this as an example:



          https://github.com/grpc/grpc/blob/master/examples/php/composer.json



          The versions were out-of-date - just take the latest releases.






          share|improve this answer













          you don't need these anymore



          "datto/protobuf-php": "dev-master",

          "repositories": [
          {
          "type": "vcs",
          "url": "https://github.com/stanley-cheung/Protobuf-PHP"
          }
          ]


          Instead, you should add "google/protobuf": "^3.6.1" to your require.



          See this as an example:



          https://github.com/grpc/grpc/blob/master/examples/php/composer.json



          The versions were out-of-date - just take the latest releases.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 16 at 18:39









          Stanley CheungStanley Cheung

          1061




          1061













          • I have replaced datto/protobuf-php to google/protobuf": "^3.6.1. But i don't know what should i do configure gRPC in laravel.

            – Yogendrasinh
            Jan 18 at 4:03











          • after adding this line "google/protobuf": "^3.6.1" any errors you got while installing dependency ?

            – Mehul Kuriya
            Jan 28 at 11:31



















          • I have replaced datto/protobuf-php to google/protobuf": "^3.6.1. But i don't know what should i do configure gRPC in laravel.

            – Yogendrasinh
            Jan 18 at 4:03











          • after adding this line "google/protobuf": "^3.6.1" any errors you got while installing dependency ?

            – Mehul Kuriya
            Jan 28 at 11:31

















          I have replaced datto/protobuf-php to google/protobuf": "^3.6.1. But i don't know what should i do configure gRPC in laravel.

          – Yogendrasinh
          Jan 18 at 4:03





          I have replaced datto/protobuf-php to google/protobuf": "^3.6.1. But i don't know what should i do configure gRPC in laravel.

          – Yogendrasinh
          Jan 18 at 4:03













          after adding this line "google/protobuf": "^3.6.1" any errors you got while installing dependency ?

          – Mehul Kuriya
          Jan 28 at 11:31





          after adding this line "google/protobuf": "^3.6.1" any errors you got while installing dependency ?

          – Mehul Kuriya
          Jan 28 at 11:31













          0














          Edit: I think i managed to solve the problem



          How to use protoc generated files with Laravel (5.7)




          • Prepare your .proto file describing your services as you would normally do

          • Set as package name package app.grpc;

          • Run the generation command: protoc --php_out=./ --grpc_out=./ --plugin=protoc-gen-grpc=/your/path/to/grpc_php_plugin yourfile.proto

          • Now copy App/Grpc inside laravel App

          • Copy GPBMetadata folder as new folder in laravel root

          • Change composer.json file inserting "GPBMetadata" in the autoload classmap section (where there are also database seeds and factories)

          • Run command composer dump-autoload

          • Now you can use your generated classes in any controller, remember to add "use AppGrpcYourClassName" at the top.


          Useful screenshots:



          composer.json file



          let me know if someone have better solutions to this





          I'm having the same problem too.



          First you need to generate PHP classes with Protoc, but then I don't know where to place those classes.



          protoc generates two namespaces "GPBMetadata" and "YourService"



          now, if I copy those two folders inside the App then the namespace will not match laravel folder schema and it will not works but at the same time we cannot change the namespace manually in the generated files otherwise it will not match the descriptor pool and will result in error



          So the solution could be to place the two classes in the root of laravel and modify the composer autoload, but i'm pretty sure this is not the right way to do it.



          Someone have any idea?









          share|improve this answer


























          • This does not provide an answer to the question. You can search for similar questions, or refer to the related and linked questions on the right-hand side of the page to find an answer. If you have a related but different question, ask a new question, and include a link to this one to help provide context. See: Ask questions, get answers, no distractions

            – Zoe
            Jan 19 at 10:01
















          0














          Edit: I think i managed to solve the problem



          How to use protoc generated files with Laravel (5.7)




          • Prepare your .proto file describing your services as you would normally do

          • Set as package name package app.grpc;

          • Run the generation command: protoc --php_out=./ --grpc_out=./ --plugin=protoc-gen-grpc=/your/path/to/grpc_php_plugin yourfile.proto

          • Now copy App/Grpc inside laravel App

          • Copy GPBMetadata folder as new folder in laravel root

          • Change composer.json file inserting "GPBMetadata" in the autoload classmap section (where there are also database seeds and factories)

          • Run command composer dump-autoload

          • Now you can use your generated classes in any controller, remember to add "use AppGrpcYourClassName" at the top.


          Useful screenshots:



          composer.json file



          let me know if someone have better solutions to this





          I'm having the same problem too.



          First you need to generate PHP classes with Protoc, but then I don't know where to place those classes.



          protoc generates two namespaces "GPBMetadata" and "YourService"



          now, if I copy those two folders inside the App then the namespace will not match laravel folder schema and it will not works but at the same time we cannot change the namespace manually in the generated files otherwise it will not match the descriptor pool and will result in error



          So the solution could be to place the two classes in the root of laravel and modify the composer autoload, but i'm pretty sure this is not the right way to do it.



          Someone have any idea?









          share|improve this answer


























          • This does not provide an answer to the question. You can search for similar questions, or refer to the related and linked questions on the right-hand side of the page to find an answer. If you have a related but different question, ask a new question, and include a link to this one to help provide context. See: Ask questions, get answers, no distractions

            – Zoe
            Jan 19 at 10:01














          0












          0








          0







          Edit: I think i managed to solve the problem



          How to use protoc generated files with Laravel (5.7)




          • Prepare your .proto file describing your services as you would normally do

          • Set as package name package app.grpc;

          • Run the generation command: protoc --php_out=./ --grpc_out=./ --plugin=protoc-gen-grpc=/your/path/to/grpc_php_plugin yourfile.proto

          • Now copy App/Grpc inside laravel App

          • Copy GPBMetadata folder as new folder in laravel root

          • Change composer.json file inserting "GPBMetadata" in the autoload classmap section (where there are also database seeds and factories)

          • Run command composer dump-autoload

          • Now you can use your generated classes in any controller, remember to add "use AppGrpcYourClassName" at the top.


          Useful screenshots:



          composer.json file



          let me know if someone have better solutions to this





          I'm having the same problem too.



          First you need to generate PHP classes with Protoc, but then I don't know where to place those classes.



          protoc generates two namespaces "GPBMetadata" and "YourService"



          now, if I copy those two folders inside the App then the namespace will not match laravel folder schema and it will not works but at the same time we cannot change the namespace manually in the generated files otherwise it will not match the descriptor pool and will result in error



          So the solution could be to place the two classes in the root of laravel and modify the composer autoload, but i'm pretty sure this is not the right way to do it.



          Someone have any idea?









          share|improve this answer















          Edit: I think i managed to solve the problem



          How to use protoc generated files with Laravel (5.7)




          • Prepare your .proto file describing your services as you would normally do

          • Set as package name package app.grpc;

          • Run the generation command: protoc --php_out=./ --grpc_out=./ --plugin=protoc-gen-grpc=/your/path/to/grpc_php_plugin yourfile.proto

          • Now copy App/Grpc inside laravel App

          • Copy GPBMetadata folder as new folder in laravel root

          • Change composer.json file inserting "GPBMetadata" in the autoload classmap section (where there are also database seeds and factories)

          • Run command composer dump-autoload

          • Now you can use your generated classes in any controller, remember to add "use AppGrpcYourClassName" at the top.


          Useful screenshots:



          composer.json file



          let me know if someone have better solutions to this





          I'm having the same problem too.



          First you need to generate PHP classes with Protoc, but then I don't know where to place those classes.



          protoc generates two namespaces "GPBMetadata" and "YourService"



          now, if I copy those two folders inside the App then the namespace will not match laravel folder schema and it will not works but at the same time we cannot change the namespace manually in the generated files otherwise it will not match the descriptor pool and will result in error



          So the solution could be to place the two classes in the root of laravel and modify the composer autoload, but i'm pretty sure this is not the right way to do it.



          Someone have any idea?










          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 19 at 10:38

























          answered Jan 19 at 9:57









          dimiandredimiandre

          12




          12













          • This does not provide an answer to the question. You can search for similar questions, or refer to the related and linked questions on the right-hand side of the page to find an answer. If you have a related but different question, ask a new question, and include a link to this one to help provide context. See: Ask questions, get answers, no distractions

            – Zoe
            Jan 19 at 10:01



















          • This does not provide an answer to the question. You can search for similar questions, or refer to the related and linked questions on the right-hand side of the page to find an answer. If you have a related but different question, ask a new question, and include a link to this one to help provide context. See: Ask questions, get answers, no distractions

            – Zoe
            Jan 19 at 10:01

















          This does not provide an answer to the question. You can search for similar questions, or refer to the related and linked questions on the right-hand side of the page to find an answer. If you have a related but different question, ask a new question, and include a link to this one to help provide context. See: Ask questions, get answers, no distractions

          – Zoe
          Jan 19 at 10:01





          This does not provide an answer to the question. You can search for similar questions, or refer to the related and linked questions on the right-hand side of the page to find an answer. If you have a related but different question, ask a new question, and include a link to this one to help provide context. See: Ask questions, get answers, no distractions

          – Zoe
          Jan 19 at 10:01


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54016622%2flaravel-5-7-grpc-integration%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          Npm cannot find a required file even through it is in the searched directory