PHPackages                             hungthai1401/laravel-grpc-validation - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. hungthai1401/laravel-grpc-validation

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

hungthai1401/laravel-grpc-validation
====================================

gRPC Validation for Laravel

v0.0.1(1y ago)3383↓50%MITPHPPHP &gt;=8.0

Since May 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hungthai1401/laravel-grpc-validation)[ Packagist](https://packagist.org/packages/hungthai1401/laravel-grpc-validation)[ RSS](/packages/hungthai1401-laravel-grpc-validation/feed)WikiDiscussions main Synced 1mo ago

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

Laravel gRPC Validation
=======================

[](#laravel-grpc-validation)

A Laravel package for gRPC validation inspired by [friendsofhyperf/grpc-validation](https://github.com/friendsofhyperf/grpc-validation). This package provides a seamless way to validate gRPC requests in Laravel applications using Attributes.

Features
--------

[](#features)

- **Attribute-based Validation**: Utilize PHP Attributes to define validation rules directly on your gRPC service methods.
- **Flexible Rule Definition**: Supports passing validation rules as an array or using a Laravel `FormRequest` class for more complex validation logic.
- **PHP Compatibility**: Designed to work with PHP 8.0 and above, ensuring modern PHP features and compatibility.
- **Strict Standards**: Adheres to PSR standards and passes PHPStan at the strictest level for robust code quality.
- **Unit Tested**: Comprehensive unit tests are included to ensure reliability and maintainability.
- **Final Classes and Strict Types**: Uses `final` classes and strict type declarations for better code integrity and predictability.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require hungthai1401/laravel-grpc-validation
```

Usage
-----

[](#usage)

First of all, you need to set up your gRPC server.

```
use Spiral\RoadRunner\GRPC\InvokerInterface;

$worker = Worker::create();
$invoker = $this->container->make(InvokerInterface::class);
$server = new GrpcServer($invoker);

$server->registerService(..., ...);

// The server will use the configuration from .rr.yaml or environment
$server->serve($worker);

return 0;
```

Then you need to define your gRPC service methods with validation attributes. Here's an example:

```
use HT\GrpcValidation\Validation;
use GoodByeFormRequest;

#[Validation(
    rules: [
        'name' => 'required|string|max:10',
        'message' => 'required|string|max:500',
    ],
    messages: [
        'name.required' => 'Name is required',
        'name.string' => 'Name must be a string',
        'name.max' => 'Name must not exceed 10 characters',
        'message.required' => 'Message is required',
        'message.string' => 'Message must be a string',
        'message.max' => 'Message must not exceed 500 characters',
    ],
    attributes: [
        'name' => 'Name',
        'message' => 'Message',
    ],
)]
public function sayHello(HiUser $user)
{
    $message = new HiReply();
    $message->setMessage("Hello World");
    $message->setUser($user);
    return $message;
}

#[Validation(formRequest: GoodByeFormRequest::class)]
public function sayGoodBye(GoodByeUser $user)
{
    $message = new GoodByeReply();
    $message->setMessage("Goodbye World");
    $message->setUser($user);
    return $message;
}
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request or open an Issue on GitHub.

Thanks
------

[](#thanks)

- [Hyperf grpc-validation](https://github.com/friendsofhyperf/grpc-validation)
- [Spiral Framework](https://spiral.dev/)

License
-------

[](#license)

This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance49

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

370d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d5f59d09234e607b58b41512746b2cc9ba697d85486d9012a762aaf739aa30da?d=identicon)[hungthai1401](/maintainers/hungthai1401)

---

Top Contributors

[![hungthai1401](https://avatars.githubusercontent.com/u/22017922?v=4)](https://github.com/hungthai1401 "hungthai1401 (8 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hungthai1401-laravel-grpc-validation/health.svg)

```
[![Health](https://phpackages.com/badges/hungthai1401-laravel-grpc-validation/health.svg)](https://phpackages.com/packages/hungthai1401-laravel-grpc-validation)
```

###  Alternatives

[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[sunspikes/clamav-validator

Custom Laravel 5 anti-virus validator for file uploads.

3651.8M3](/packages/sunspikes-clamav-validator)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2412.2M5](/packages/laravel-validation-rules-credit-card)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
