PHPackages                             redis-ventures/redisvl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. redis-ventures/redisvl

ActiveLibrary[Database &amp; ORM](/categories/database)

redis-ventures/redisvl
======================

Redis Vector Library (RedisVL) enables Redis as a real-time database for LLM applications, based on Predis PHP client

v0.2.3(2y ago)1215.5k↓31.4%[3 issues](https://github.com/RedisVentures/redis-vector-php/issues)MITPHPPHP ^8.1

Since Jan 31Pushed 2y ago2 watchersCompare

[ Source](https://github.com/RedisVentures/redis-vector-php)[ Packagist](https://packagist.org/packages/redis-ventures/redisvl)[ RSS](/packages/redis-ventures-redisvl/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (18)Used By (0)

Introduction
------------

[](#introduction)

The Redis Vector Library (RedisVL) is a PHP client for AI applications leveraging Redis.

Designed for:

- Vector similarity search
- Recommendation engine

A perfect tool for Redis-based applications, incorporating capabilities like vector-based semantic search, full-text search, and geo-spatial search.

Getting started
---------------

[](#getting-started)

### Installation

[](#installation)

```
composer install redis-ventures/redisvl
```

### Setting up Redis

[](#setting-up-redis)

Choose from multiple Redis deployment options:

1. [Redis Cloud](https://redis.com/try-free/): Managed cloud database (free tier available)
2. [Redis Stack](https://redis.io/docs/install/install-stack/docker/): Docker image for development

```
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
```

3. [Redis Enterprise](https://redis.com/redis-enterprise/advantages/): Commercial, self-hosted database

What's included?
----------------

[](#whats-included)

### Redis index management

[](#redis-index-management)

1. Design your schema that models your dataset with one of the available Redis data structures (HASH, JSON) and indexable fields (e.g. text, tags, numerics, geo, and vectors).

Load schema as a dictionary:

```
$schema = [
    'index' => [
        'name' => 'products',
        'prefix' => 'product:',
        'storage_type' => 'hash',
    ],
    'fields' => [
        'id' => [
            'type' => 'numeric',
        ],
        'categories' => [
            'type' => 'tag',
        ],
        'description' => [
            'type' => 'text',
        ],
        'description_embedding' => [
             'type' => 'vector',
             'dims' => 3,
             'datatype' => 'float32',
             'algorithm' => 'flat',
             'distance_metric' => 'cosine'
        ],
    ],
];
```

2. Create a SearchIndex object with an input schema and client connection to be able to interact with your Redis index

```
use Predis\Client;
use RedisVentures\RedisVl\Index\SearchIndex;

$client = new Client();
$index = new SearchIndex($client, $schema);

// Creates index in the Redis
$index->create();
```

3. Load/fetch your data from index. If you have a hash index data should be loaded as key-value pairs , for json type data loads as json string.

```
$data = ['id' => '1', 'count' => 10, 'id_embeddings' => VectorHelper::toBytes([0.000001, 0.000002, 0.000003])];

// Loads given dataset associated with given key.
$index->load('key', $data);

// Fetch dataset corresponding to given key
$index->fetch('key');
```

### Realtime search

[](#realtime-search)

Define queries and perform advanced search over your indices, including combination of vectors and variety of filters.

**VectorQuery** - flexible vector-similarity semantic search with customizable filters

```
use RedisVentures\RedisVl\Query\VectorQuery;

$query = new VectorQuery(
    [0.001, 0.002, 0.03],
    'description_embedding',
    null,
    3
);

// Run vector search against vector field specified in schema.
$results = $index->query($query);
```

Incorporate complex metadata filters on your queries:

```
use RedisVentures\RedisVl\Query\Filter\TagFilter;
use RedisVentures\RedisVl\Enum\Condition;

$filter = new TagFilter(
    'categories',
    Condition::equal,
    'foo'
);

$query = new VectorQuery(
    [0.001, 0.002, 0.03],
    'description_embedding',
    null,
    10,
    true,
    2,
    $filter
);

// Results will be filtered by tag field values.
$results = $index->query($query);
```

### Filter types

[](#filter-types)

#### Numeric

[](#numeric)

Numeric filters could be applied to numeric fields. Supports variety of conditions applicable for scalar types (==, !=, &lt;, &gt;, &lt;=, &gt;=). More information [here](https://redis.io/docs/interact/search-and-query/query/range/).

```
use RedisVentures\RedisVl\Query\Filter\NumericFilter;
use RedisVentures\RedisVl\Enum\Condition;

$equal = new NumericFilter('numeric', Condition::equal, 10);
$notEqual = new NumericFilter('numeric', Condition::notEqual, 10);
$greaterThan = new NumericFilter('numeric', Condition::greaterThan, 10);
$greaterThanOrEqual = new NumericFilter('numeric', Condition::greaterThanOrEqual, 10);
$lowerThan = new NumericFilter('numeric', Condition::lowerThan, 10);
$lowerThanOrEqual = new NumericFilter('numeric', Condition::lowerThanOrEqual, 10);
```

#### Tag

[](#tag)

Tag filters could be applied to tag fields. Single or multiple values can be provided, single values supports only equality conditions (==, !==), for multiple tags additional conjunction (AND, OR) could be specified. More information [here](https://redis.io/docs/interact/search-and-query/advanced-concepts/tags/)

```
use RedisVentures\RedisVl\Query\Filter\TagFilter;
use RedisVentures\RedisVl\Enum\Condition;
use RedisVentures\RedisVl\Enum\Logical;

$singleTag = new TagFilter('tag', Condition::equal, 'value')
$multipleTags = new TagFilter('tag', Condition::notEqual, [
    'conjunction' => Logical::or,
    'tags' => ['value1', 'value2']
])
```

#### Text

[](#text)

Text filters could be applied to text fields. Values can be provided as a single word or multiple words with specified condition. Empty value corresponds to all values (\*). More information [here](https://redis.io/docs/interact/search-and-query/query/full-text/)

```
use RedisVentures\RedisVl\Query\Filter\TextFilter;
use RedisVentures\RedisVl\Enum\Condition;

$single = new TextFilter('text', Condition::equal, 'foo');

// Matching foo AND bar
$multipleAnd = new TextFilter('text', Condition::equal, 'foo bar');

// Matching foo OR bar
$multipleOr = new TextFilter('text', Condition::equal, 'foo|bar');

// Perform fuzzy search
$fuzzy = new TextFilter('text', Condition::equal, '%foobaz%');
```

#### Geo

[](#geo)

Geo filters could be applied to geo fields. Supports only equality conditions, value should be specified as specific-shape array. More information [here](https://redis.io/docs/interact/search-and-query/query/geo-spatial/)

```
use RedisVentures\RedisVl\Query\Filter\GeoFilter;
use RedisVentures\RedisVl\Enum\Condition;
use RedisVentures\RedisVl\Enum\Unit;

$geo = new GeoFilter('geo', Condition::equal, [
    'lon' => 10.111,
    'lat' => 11.111,
    'radius' => 100,
    'unit' => Unit::kilometers
]);
```

#### Aggregate

[](#aggregate)

To apply multiple filters to a single query use AggregateFilter. If there's the same logical operator that should be applied for each filter you can pass values in constructor,
if you need a specific combination use `and()` and `or()` methods to create combined filter.

```
use RedisVentures\RedisVl\Query\Filter\AggregateFilter;
use RedisVentures\RedisVl\Query\Filter\TextFilter;
use RedisVentures\RedisVl\Query\Filter\NumericFilter;
use RedisVentures\RedisVl\Enum\Condition;
use RedisVentures\RedisVl\Enum\Logical;

$aggregate = new AggregateFilter([
    new TextFilter('text', Condition::equal, 'value'),
    new NumericFilter('numeric', Condition::greaterThan, 10)
], Logical::or);

$combinedAggregate = new AggregateFilter();
$combinedAggregate
    ->and(
        new TextFilter('text', Condition::equal, 'value'),
        new NumericFilter('numeric', Condition::greaterThan, 10)
    )->or(
        new NumericFilter('numeric', Condition::lowerThan, 100)
    );
```

Vectorizers
-----------

[](#vectorizers)

To be able to effectively create vector representations for your indexed data or queries, you have to use [LLM's](https://en.wikipedia.org/wiki/Large_language_model). There's a variety of vectorizers that provide integration with popular embedding models.

The only required option is your API key specified as environment variable or configuration option.

### OpenAI

[](#openai)

```
use RedisVentures\RedisVl\Vectorizer\Factory;

putenv('OPENAI_API_TOKEN=your_token');

$factory = new Factory();
$vectorizer = $factory->createVectorizer('openai');

// Creates vector representation of given text.
$embedding = $vectorizer->embed('your_text')

// Creates a single vector representation from multiple chunks.
$mergedEmbedding = $vectorizer->batchEmbed(['first_chunk', 'second_chunk']);
```

### VectorHelper

[](#vectorhelper)

When you perform vector queries against Redis or load hash data into index that contains vector field data, your vector should be represented as a blob string. VectorHelper allows you to create blob representation from your vector represented as array of floats.

```
use RedisVentures\RedisVl\VectorHelper;

$blobVector = VectorHelper::toBytes([0.001, 0.002, 0.003]);
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

5

Last Release

809d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/edb0c7a9ac2147655bb0f30515c788cd819874a8c581ab188cf7641c1594b7d3?d=identicon)[redis](/maintainers/redis)

---

Top Contributors

[![vladvildanov](https://avatars.githubusercontent.com/u/117659936?v=4)](https://github.com/vladvildanov "vladvildanov (17 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/redis-ventures-redisvl/health.svg)

```
[![Health](https://phpackages.com/badges/redis-ventures-redisvl/health.svg)](https://phpackages.com/packages/redis-ventures-redisvl)
```

###  Alternatives

[kreait/firebase-php

Firebase Admin SDK

2.4k39.7M72](/packages/kreait-firebase-php)[tpetry/laravel-mysql-explain

Get Visual MySQL EXPLAIN for Laravel.

264154.2k](/packages/tpetry-laravel-mysql-explain)[aternus/geonames-client

GeoNames API Client

39215.5k2](/packages/aternus-geonames-client)[gearbox-solutions/eloquent-filemaker

A package for getting FileMaker records as Eloquent models in Laravel

6454.8k2](/packages/gearbox-solutions-eloquent-filemaker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
