wishborn / laravel-cognee
Laravel wrapper for the Cognee PHP SDK - Transform raw data into persistent AI memory
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/wishborn/laravel-cognee
Requires
- php: ^8.2
- illuminate/support: ^11.0|^12.0
- wishborn/alt-php-cognee-sdk: ^0.1
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
README
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 datasetCognee::datasets()->list()- List all datasetsCognee::datasets()->get($id)- Get a specific datasetCognee::datasets()->delete($id)- Delete a datasetCognee::datasets()->add($request)- Add data to a datasetCognee::datasets()->cognify($request)- Process data into knowledge graphCognee::datasets()->getGraph($id)- Get dataset graphCognee::datasets()->getStatus($id)- Get dataset processing status
Search
Cognee::search()->search($request)- Search the knowledge graphCognee::search()->history()- Get search history
Health
Cognee::health()->check()- Basic health checkCognee::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.