PHPackages                             travel/grpc-proto - 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. travel/grpc-proto

ActiveLibrary[API Development](/categories/api)

travel/grpc-proto
=================

Shared gRPC proto definitions and generated PHP code for Travel services

024PHP

Since Dec 4Pushed 5mo agoCompare

[ Source](https://github.com/Vinh-Dev-16/travel-gRPC)[ Packagist](https://packagist.org/packages/travel/grpc-proto)[ RSS](/packages/travel-grpc-proto/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Travel gRPC Proto Library
=========================

[](#travel-grpc-proto-library)

Shared gRPC protocol buffer definitions and generated PHP code for Travel services.

📁 Structure
-----------

[](#-structure)

```
travel-gRPC/
├── composer.json           # Library definition
├── protos/                 # Proto source files (edit these)
│   └── tour/
│       └── v1/
│           └── tour.proto
├── src/                    # Generated PHP code (DO NOT edit manually)
│   └── Travel/
│       └── Proto/
│           └── Tour/
│               └── V1/
│                   ├── TourServiceClient.php
│                   ├── GetTourByIdRequest.php
│                   ├── ListToursRequest.php
│                   ├── TourResponse.php
│                   └── ListToursResponse.php
└── scripts/
    └── generate.sh         # Compilation script

```

🚀 Installation
--------------

[](#-installation)

### Prerequisites

[](#prerequisites)

1. **Protocol Buffers Compiler (protoc)**

    ```
    # Ubuntu/Debian
    sudo apt-get install -y protobuf-compiler

    # macOS
    brew install protobuf

    # Or download from: https://github.com/protocolbuffers/protobuf/releases
    ```
2. **gRPC PHP Plugin** (optional, for service generation)

    ```
    # Follow instructions at: https://grpc.io/docs/languages/php/quickstart/
    ```

### Install the Library

[](#install-the-library)

Add to your Laravel project's `composer.json`:

```
{
  "repositories": [
    {
      "type": "path",
      "url": "../travel-gRPC"
    }
  ],
  "require": {
    "travel/grpc-proto": "*"
  }
}
```

Then run:

```
composer install
```

🔧 Usage
-------

[](#-usage)

### 1. Define Proto Files

[](#1-define-proto-files)

Edit or add `.proto` files in the `protos/` directory:

```
// protos/tour/v1/tour.proto
syntax = "proto3";

package tour.v1;

option php_namespace = "Travel\\Proto\\Tour\\V1";
```

### 2. Generate PHP Code

[](#2-generate-php-code)

Run the generation script:

```
# From the library root
composer generate

# Or directly
bash scripts/generate.sh
```

This will compile all `.proto` files and generate PHP classes in the `src/` directory.

### 3. Use in Your Laravel Services

[](#3-use-in-your-laravel-services)

#### Server Side (Service Implementation)

[](#server-side-service-implementation)

```
