futuremeng/ragflow-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

futuremeng/ragflow-laravel

Composer 安装命令:

composer require futuremeng/ragflow-laravel

包简介

RAGFlow PHP for Laravel is a supercharged PHP API client that allows you to interact with the RAGFlow API

README 文档

README

GitHub Workflow Status (master) Total Downloads Latest Version License

RAGFlow PHP for Laravel is a community-maintained PHP API client that allows you to interact with the RAGFlow API. If you or your business relies on this package, it's important to support the developers who have contributed their time and effort to create and maintain this valuable tool:

Note: This repository contains the integration code of the RAGFlow PHP for Laravel. If you want to use the RAGFlow PHP client in a framework-agnostic way, take a look at the futuremeng/RAGFlow-php-client repository.

Get Started

Requires PHP 8.1+

First, install RAGFlow via the Composer package manager:

composer require futuremeng/RAGFlow-laravel

Next, execute the install command:

php artisan ragflow:install

This will create a config/ragflow.php configuration file in your project, which you can modify to your needs using environment variables. Blank environment variables for the RAGFlow API key and RAGFLOW_ENDPOINT id are already appended to your .env file.

RAGFLOW_API_KEY=sk-...
and RAGFLOW_ENDPOINT=https://ragflow.com/api/v1

Finally, you may use the RAGFlow facade to access the RAGFlow API:

use RAGFlow\Laravel\Facades\RAGFlow;

$result = RAGFlow::chat()->create([
    'message' =>'Hello!',
]);

echo $result->completion->content; // Hello! How can I assist you today?

Configuration

Configuration is done via environment variables or directly in the configuration file (config/ragflow.php).

RAGFlow API Key and RAGFLOW_ENDPOINT

Specify your RAGFlow API Key and RAGFLOW_ENDPOINT. This will be used to authenticate with the RAGFlow API - you can find your API key on your RAGFlow dashboard, at https://ragflow.com.

RAGFLOW_API_KEY=
RAGFLOW_ENDPOINT=

Request Timeout

The timeout may be used to specify the maximum number of seconds to wait for a response. By default, the client will time out after 30 seconds.

RAGFLOW_REQUEST_TIMEOUT=

Usage

For usage examples, take a look at the futuremeng/RAGFlow-php-client repository.

Testing

The RAGFlow facade comes with a fake() method that allows you to fake the API responses.

The fake responses are returned in the order they are provided to the fake() method.

All responses are having a fake() method that allows you to easily create a response object by only providing the parameters relevant for your test case.

use RAGFlow\Laravel\Facades\RAGFlow;
use RAGFlow\Responses\Completions\CreateResponse;

RAGFlow::fake([
    CreateResponse::fake([
        'choices' => [
            [
                'text' => 'awesome!',
            ],
        ],
    ]),
]);

$completion = RAGFlow::completions()->create([
    'model' => 'gpt-3.5-turbo-instruct',
    'prompt' => 'PHP is ',
]);

expect($completion['choices'][0]['text'])->toBe('awesome!');

After the requests have been sent there are various methods to ensure that the expected requests were sent:

// assert completion create request was sent
RAGFlow::assertSent(Completions::class, function (string $method, array $parameters): bool {
    return $method === 'create' &&
        $parameters['model'] === 'gpt-3.5-turbo-instruct' &&
        $parameters['prompt'] === 'PHP is ';
});

For more testing examples, take a look at the futuremeng/RAGFlow-php-client repository.

RAGFlow PHP for Laravel is an open-sourced software licensed under the MIT license.

futuremeng/ragflow-laravel 适用场景与选型建议

futuremeng/ragflow-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「api」 「client」 「language」 「sdk」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 futuremeng/ragflow-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 futuremeng/ragflow-laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 futuremeng/ragflow-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-24