Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

linkerlin/GraphRedis

Repository files navigation

GraphRedis

A lightweight graph database implementation using Redis as storage backend. 【中文介绍】

Installation

Via Composer

composer require graphredis/graphredis

Manual Installation

git clone https://github.com/yourname/GraphRedis.git
cd GraphRedis
composer install

Requirements

  • PHP 7.4+
  • Redis server
  • PHP Redis extension

Quick Start

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);

Usage

Run Demo

composer run demo

Run Tests

composer run test

Code Quality

# Static analysis
composer run phpstan
# Code style check
composer run cs-check
# Code style fix
composer run cs-fix

Documentation

For detailed documentation in Chinese, see README_CN.md.

License

Apache License - see LICENSE file for details. 【中文介绍】 ae55f8b030c0aa87b4c4303f8a02db7d.png

About

A Graph Database with Redis!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /