wishborn / alt-php-cognee-sdk
PHP SDK for Cognee - AI Memory Platform (Cognee v0.5.1+ compatible)
Installs: 6
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/wishborn/alt-php-cognee-sdk
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.8
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- mockery/mockery: ^1.6
- phpunit/phpunit: ^11.0
README
A PHP SDK for Cognee - the AI Memory Platform. This package is compatible with Cognee v0.5.1+.
Note: This is an independently maintained alternative to mikewolfxyou/php-cognee-sdk, updated for Cognee v0.5.1 API compatibility. Once the upstream package is updated, we recommend switching back to it.
Requirements
- PHP 8.2 or higher
- A running Cognee instance (v0.5.1+)
Installation
composer require wishborn/alt-php-cognee-sdk
Quick Start
use Cognee\Client; use Cognee\Config; use Cognee\Requests\SearchRequest; use Cognee\Enums\SearchType; // Create a client $config = new Config( baseUrl: 'http://localhost:8000', apiKey: 'your-api-key', ); $client = new Client($config); // Check health $health = $client->health()->check(); // Create a dataset $dataset = $client->datasets()->create('my-dataset'); // Search the knowledge graph $results = $client->search()->search(new SearchRequest( query: 'your search query', searchType: SearchType::CHUNKS, ));
Available Search Types
The SDK supports all Cognee v0.5.1 search types:
SearchType::SUMMARIESSearchType::CHUNKS(default)SearchType::CHUNKS_LEXICALSearchType::RAG_COMPLETIONSearchType::TRIPLET_COMPLETIONSearchType::GRAPH_COMPLETIONSearchType::GRAPH_SUMMARY_COMPLETIONSearchType::CYPHERSearchType::NATURAL_LANGUAGESearchType::GRAPH_COMPLETION_COTSearchType::GRAPH_COMPLETION_CONTEXT_EXTENSIONSearchType::FEELING_LUCKYSearchType::FEEDBACKSearchType::TEMPORALSearchType::CODING_RULES
Available Resources
Datasets
$client->datasets()->create($name, $metadata); // Create dataset $client->datasets()->list(); // List all datasets $client->datasets()->get($id); // Get specific dataset $client->datasets()->delete($id); // Delete dataset $client->datasets()->add($request); // Add data to dataset $client->datasets()->cognify($request); // Process into knowledge graph $client->datasets()->getGraph($id); // Get dataset graph $client->datasets()->getStatus($id); // Get processing status
Search
$client->search()->search($request); // Search knowledge graph $client->search()->history(); // Get search history
Health
$client->health()->check(); // Basic health check $client->health()->detailed(); // Detailed health check
Auth & Permissions
$client->auth()->login($email, $password); $client->permissions()->list();
Testing
composer test
Changelog
v0.1.0
- Initial release with Cognee v0.5.1 API compatibility
- Updated SearchType enum with all supported values
- Default search type set to CHUNKS
Credits
- Based on mikewolfxyou/php-cognee-sdk
- Maintained by Wishborn
License
The MIT License (MIT). Please see License File for more information.