PHPackages                             haskel/grpc-web-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. haskel/grpc-web-bundle

ActiveSymfony-bundle[API Development](/categories/api)

haskel/grpc-web-bundle
======================

Symfony bundle for gRPC-Web protocol

v0.1.0(2y ago)06MITPHPPHP &gt;=8.1

Since Aug 11Pushed 2y ago1 watchersCompare

[ Source](https://github.com/haskel/grpc-web-bundle)[ Packagist](https://packagist.org/packages/haskel/grpc-web-bundle)[ RSS](/packages/haskel-grpc-web-bundle/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

gRPC-Web Bundle
---------------

[](#grpc-web-bundle)

### Installation

[](#installation)

```
composer require haskel/grpc-web-bundle
```

Add bundle to `config/bundles.php`:

```
return [
    // ...
    Haskel\GrpcWebBundle\GrpcWebBundle::class => ['all' => true],
];
```

### Configuration

[](#configuration)

```
# config/packages/grpc_web.yaml

grpc_web:
  # optional namespace of proto files
  proto_namespace: 'my.somenamespace.api'

  # optional name of response type attribute in request object
  response_type_attribute_name: '_grpc_response_type'

  # map of exception classes to grpc standard response codes
  exception_code_map:
    App\Exception\ValidationException: 1
    App\Exception\InvalidArgumentException: 2

  # configuration of integration with lexik_jwt_authentication bundle
  security:
    # optional class of success response builder
    success_response_builder: 'App\Security\SuccessResponseBuilder'
    # optional class of failure response builder
    failure_response_builder: 'App\Security\FailureResponseBuilder'
    # required class of sign in request
    sign_in_request_class: 'App\Model\Api\SignInRequest'
```

### Usage

[](#usage)

#### Create proto file

[](#create-proto-file)

```
syntax = "proto3";

package grpc.api;

service PingService {
    rpc Ping (PingRequest) returns (PingResponse) {}
}

message PingRequest {
    string message = 1;
}

message PingResponse {
    string message = 1;
}
```

#### Generate php code

[](#generate-php-code)

```
protoc --php_out=src --grpc-web_out=mode=grpcwebtext:src --proto_path=config/proto
```

#### Create controller

[](#create-controller)

```
