Download the PHP package vandarpay/laravel-grpc without Composer

On this page you can find all versions of the php package vandarpay/laravel-grpc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-grpc

Laravel Grpc

This package is prepared for implementing GRPC on the server side and client side in Laravel to implement the microservice structure.

Please follow the steps below to set up the desired section, Also, at the end of the page, examples are given that will give you a better understanding

Installation

Publish Necessary File

Requirement


Server Side

This package use RoadRunner for manage process and implement grpc server, RoadRunner is a high-performance PHP application server, load-balancer, and process manager written in Golang.

Installation RoadRunner Binary

You can also install RoadRunner automatically using command shipped with the composer package, run:

Server binary will be available at the root of your project.

PHP's extensions php-curl and php-zip are required to download RoadRunner automatically. PHP's extensions php-sockets need to be installed to run roadrunner. Check with php --modules your installed extensions.

Environments

Please add this environment variable to .env file

#Available value : panic, error, warn, info, debug. Default: debug
ROAD_RUNNER_LOG_LEVEL=debug
GRPC_XDEBUG=0 # 1,0
GRPC_SERVER=tcp://127.0.0.1:6001
GRPC_WORKER_MAX_JOBS=0
GRPC_WORKER_NUM_WORKERS=2

To activate xDebug make sure to set the xdebug.mode=debug in your php.ini.

To enable xDebug in your application make sure to set ENV variable GRPC_XDEBUG

Consider the address you want for the GRPC server

Maximal count of worker executions. Zero (or nothing) means no limit.(Default: 0)

How many worker processes will be started. Zero (or nothing) means the number of logical CPUs.(Default : 0)

Make New Service

Compile proto files

To start, create a proto file named echo.proto in path app/Protobuf and copy the following content into it, if this folder does not exist, create it

Note that the following 3 lines of this file should not be changed

Install protobuf compiler

Next, after installing protoc program, execute the following command to create the required files for connection

After executing command protoc, a folder named GrpcServices is created in path app/Protobuf, which contains messages and the main service class

Create First Method

Add this line to created repository

And then in the related service, add the additional method in the repository and put its output according to the definitions of the proto file.

Register Proto File In RoadRunner

The path of file proto created in the previous step should be added in file .rr.yaml in the following way

Register Service To GRPC Server

To register the service created in method register, class App\Providers\GrpcServiceProvider.php, register your service as below

Run RoadRunner Sever

Client Side

To build the communication class on the client side, first, the proto file must be compiled like the server routine, and the communication class must be created by the following command.

The proto file should be in app/Protobuf path. And after executing the above command, folder Clients will be created in path app/Protobuf.

After this, the communication settings of the defined service should be placed in the config file grpc.php

Note: The index of this setting must be equal to the service name

In this step, transfer the proto file from the server side to the client and create the required files with the proto compiler.

Below is an example to better understand the GRPC client class

Versioning On Service

Of course, in the development of a service, there are times when there is a need to upgrade the old version, and this part is fully supported in this package. For this purpose, after considering the necessary folders for the service.

In this case, the folder structure changes as follows


All versions of laravel-grpc with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
vandarpay/service-repository Version ^0.1
ext-protobuf Version *
ext-grpc Version *
spiral/roadrunner Version ^2.11
spiral/roadrunner-laravel Version ^5.9
spiral/roadrunner-grpc Version ^2.0
nyholm/psr7 Version ^1.5
google/common-protos Version ^3.0
grpc/grpc Version ^1.36
google/protobuf Version ^3.11
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package vandarpay/laravel-grpc contains the following files

Loading the files please wait ....