PHPackages                             lyhiving/ragflow-laravel - 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. lyhiving/ragflow-laravel

ActiveLibrary[API Development](/categories/api)

lyhiving/ragflow-laravel
========================

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

v0.6(10mo ago)06MITPHPPHP ^8.1.0CI failing

Since Jun 12Pushed 10mo agoCompare

[ Source](https://github.com/lyhiving/ragflow-laravel)[ Packagist](https://packagist.org/packages/lyhiving/ragflow-laravel)[ Fund](https://www.paypal.com/paypalme/enunomaduro)[ GitHub Sponsors](https://github.com/gehrisandro)[ RSS](/packages/lyhiving-ragflow-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

 [![GitHub Workflow Status (master)](https://camo.githubusercontent.com/10a878d74329553e7a3a087ad81ab73b161e7d0ce20aaa99ff1ec079a06674ef/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6675747572656d656e672f524147466c6f772d6c61726176656c2f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d726f756e642d737175617265)](https://github.com/futuremeng/RAGFlow-laravel/actions) [![Total Downloads](https://camo.githubusercontent.com/bc55315919b5874d0899895e71728e53ce84cba2a0c22c5aa5c24f9b62f57b25/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6675747572656d656e672f524147466c6f772d6c61726176656c)](https://packagist.org/packages/futuremeng/RAGFlow-laravel) [![Latest Version](https://camo.githubusercontent.com/b3cc02b625b9b69144c73e4909e4e434306454a5897c9a9c583a0e5aabf657c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6675747572656d656e672f524147466c6f772d6c61726176656c)](https://packagist.org/packages/futuremeng/RAGFlow-laravel) [![License](https://camo.githubusercontent.com/bc257a1fe4ae962ef69dc337aa007fa9cd4d667e313e13d50444d64bf8483630/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6675747572656d656e672f524147466c6f772d6c61726176656c)](https://packagist.org/packages/futuremeng/RAGFlow-laravel)

---

**RAGFlow PHP** for Laravel is a community-maintained PHP API client that allows you to interact with the [RAGFlow API](https://beta.ragflow.com/docs/api-reference/introduction). 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:

- Nuno Maduro: **[github.com/sponsors/nunomaduro](https://github.com/sponsors/nunomaduro)**
- Sandro Gehri: **[github.com/sponsors/gehrisandro](https://github.com/sponsors/gehrisandro)**

> **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](https://github.com/futuremeng/RAGFlow-php-client) repository.

Get Started
-----------

[](#get-started)

> **Requires [PHP 8.1+](https://php.net/releases/)**

First, install RAGFlow via the [Composer](https://getcomposer.org/) 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)

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

### RAGFlow API Key and RAGFLOW\_ENDPOINT

[](#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 .

```
RAGFLOW_API_KEY=
RAGFLOW_ENDPOINT=
```

### Request Timeout

[](#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
-----

[](#usage)

For usage examples, take a look at the [futuremeng/RAGFlow-php-client](https://github.com/futuremeng/RAGFlow-php-client) repository.

Testing
-------

[](#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](https://github.com/futuremeng/RAGFlow-php-client#testing) repository.

---

RAGFlow PHP for Laravel is an open-sourced software licensed under the **[MIT license](https://opensource.org/licenses/MIT)**.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance56

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

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

Every ~1 days

Total

5

Last Release

326d ago

### Community

Maintainers

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

---

Top Contributors

[![yiguui](https://avatars.githubusercontent.com/u/202618370?v=4)](https://github.com/yiguui "yiguui (5 commits)")

---

Tags

phpapiclientlaravelsdklanguageprocessingnaturalcodexGPT-3dall-eragflow

### Embed Badge

![Health badge](/badges/lyhiving-ragflow-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/lyhiving-ragflow-laravel/health.svg)](https://phpackages.com/packages/lyhiving-ragflow-laravel)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)

PHPackages © 2026

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