A lightweight graph database implementation using Redis as storage backend. 【中文介绍】
composer require graphredis/graphredis
git clone https://github.com/yourname/GraphRedis.git
cd GraphRedis
composer install- PHP 7.4+
- Redis server
- PHP Redis extension
require_once 'vendor/autoload.php'; use GraphRedis\GraphRedis; // Create connection $graph = new GraphRedis(); // Add nodes $bob = $graph->addNode(['name' => 'Bob', 'age' => 32]); $alice = $graph->addNode(['name' => 'Alice', 'age' => 28]); // Add edge $graph->addEdge($bob, $alice, 1.0, ['type' => 'friend']); // Query neighbors $friends = $graph->neighbors($bob); // Find shortest path $path = $graph->shortestPath($bob, $alice);
composer run demo
composer run test# Static analysis composer run phpstan # Code style check composer run cs-check # Code style fix composer run cs-fix
For detailed documentation in Chinese, see README_CN.md.
Apache License - see LICENSE file for details. 【中文介绍】 ae55f8b030c0aa87b4c4303f8a02db7d.png