承接 fr3on/laravel-guardrail 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fr3on/laravel-guardrail

最新稳定版本:0.0.1

Composer 安装命令:

composer require fr3on/laravel-guardrail

包简介

Enterprise-grade input/output safety & compliance layer for AI agents.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status Total Downloads PHP Version Support Laravel Version Support License

Laravel Guardrail is an enterprise-grade input/output safety & compliance layer for the Laravel AI SDK. It acts as a firewall for your AI agents, ensuring that both user inputs and LLM responses adhere to your security, privacy, and domain policies.

Features

  • Input Guarding: Block prompt injections, redact PII (Personally Identifiable Information), and enforce input length constraints.
  • Output Guarding: Prevent topic drift, toxicity, system prompt leakage, and PII leakage in LLM responses.
  • AI SDK Middleware: Seamlessly hooks into the native Laravel AI SDK agent middleware system.
  • Violation Logging: Automatically persists safety violations for auditing and fine-tuning.
  • Zero Configuration: Sensible defaults that work out of the box with standard Laravel configurations.

Installation

You can install the package via composer:

composer require fr3on/laravel-guardrail

You can publish the config file with:

php artisan vendor:publish --tag="guardrail-config"

Usage

Register the Guardrail middleware in your Laravel AI SDK agent:

namespace App\Ai\Agents;

use Fr3on\Guardrail\Middleware\Guardrail;
use Laravel\Ai\Contracts\Agent;
use Laravel\Ai\Contracts\HasMiddleware;

class CustomerSupportAgent implements Agent, HasMiddleware
{
    public function middleware(): array
    {
        return [
            new Guardrail([
                // Input rules
                'prompt_injection' => 'block',
                'pii_redaction' => 'redact',
                
                // Output rules
                'toxicity' => 'retry',
                'topic_drift' => 'fallback',
            ]),
        ];
    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 228
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固