定制 wishborn/laravel-cognee 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

wishborn/laravel-cognee

最新稳定版本:v0.1.1

Composer 安装命令:

composer require wishborn/laravel-cognee

包简介

Laravel wrapper for the Cognee PHP SDK - Transform raw data into persistent AI memory

README 文档

README

Latest Version on Packagist Total Downloads License

A Laravel wrapper for the Alt PHP Cognee SDK - Transform raw data into persistent AI memory for your Laravel applications.

Requirements

  • PHP 8.2 or higher
  • Laravel 11.x or 12.x
  • A running Cognee instance

Installation

Install the package via Composer:

composer require wishborn/laravel-cognee

The package will automatically register its service provider and facade.

Publish Configuration

Publish the configuration file:

php artisan vendor:publish --tag=cognee-config

This will create a config/cognee.php file in your application.

Configuration

Add the following environment variables to your .env file:

COGNEE_BASE_URL=http://localhost:8000
COGNEE_API_KEY=your-api-key
COGNEE_TIMEOUT=30
COGNEE_RETRY_ATTEMPTS=3

Usage

Using the Facade

use Wishborn\Cognee\Facades\Cognee;

// Create a dataset
$dataset = Cognee::datasets()->create('my-dataset');

// Add data to a dataset
Cognee::datasets()->add(new AddDataRequest(
    data: 'Your text content here',
    datasetId: $dataset->id,
));

// Cognify (process into knowledge graph)
Cognee::datasets()->cognify(new CognifyRequest(
    datasetIds: [$dataset->id],
));

// Search the knowledge graph
$results = Cognee::search()->search(new SearchRequest(
    query: 'your search query',
    searchType: SearchType::CHUNKS,
    datasetIds: [$dataset->id],
));

Using Dependency Injection

use Wishborn\Cognee\CogneeManager;

class MyController extends Controller
{
    public function __construct(
        protected CogneeManager $cognee
    ) {}

    public function search(Request $request)
    {
        $results = $this->cognee->search()->search(
            new SearchRequest(
                query: $request->input('query'),
                searchType: SearchType::CHUNKS,
            )
        );

        return response()->json($results);
    }
}

Accessing the SDK Client Directly

For advanced operations not covered by the wrapper methods:

$client = Cognee::client();

// Use any SDK method directly
$auth = $client->auth();
$permissions = $client->permissions();

Available Methods

Datasets

  • Cognee::datasets()->create($name, $metadata) - Create a new dataset
  • Cognee::datasets()->list() - List all datasets
  • Cognee::datasets()->get($id) - Get a specific dataset
  • Cognee::datasets()->delete($id) - Delete a dataset
  • Cognee::datasets()->add($request) - Add data to a dataset
  • Cognee::datasets()->cognify($request) - Process data into knowledge graph
  • Cognee::datasets()->getGraph($id) - Get dataset graph
  • Cognee::datasets()->getStatus($id) - Get dataset processing status

Search

  • Cognee::search()->search($request) - Search the knowledge graph
  • Cognee::search()->history() - Get search history

Health

  • Cognee::health()->check() - Basic health check
  • Cognee::health()->detailed() - Detailed health check

Testing

composer test

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email security@example.com instead of using the issue tracker.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固