A lightweight graph database implementation using Redis as storage backend. 【中文介绍】
composer require graphredis/graphredisgit 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 democomposer run test# Static analysis
composer run phpstan
# Code style check
composer run cs-check
# Code style fix
composer run cs-fixFor detailed documentation in Chinese, see README_CN.md.
