{"id":36995569,"url":"https://github.com/redis-applied-ai/redis-vector-php","last_synced_at":"2026-01-13T23:47:53.599Z","repository":{"id":220097577,"uuid":"750747714","full_name":"redis-applied-ai/redis-vector-php","owner":"redis-applied-ai","description":"Redis Vector Library (RedisVL) enables Redis as a real-time database for LLM applications, based on Predis PHP client","archived":false,"fork":false,"pushed_at":"2024-02-29T15:33:39.000Z","size":71,"stargazers_count":12,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-26T17:59:14.595Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redis-applied-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-01-31T08:37:36.000Z","updated_at":"2025-03-01T04:47:48.000Z","dependencies_parsed_at":"2024-02-29T15:57:03.662Z","dependency_job_id":"49c7ed0c-46f8-474c-b0cf-13302111b2f3","html_url":"https://github.com/redis-applied-ai/redis-vector-php","commit_stats":null,"previous_names":["vladvildanov/predis-vl","redisventures/predis-vl","redis-applied-ai/redis-vector-php","redisventures/redis-vector-php"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/redis-applied-ai/redis-vector-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-applied-ai%2Fredis-vector-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-applied-ai%2Fredis-vector-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-applied-ai%2Fredis-vector-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-applied-ai%2Fredis-vector-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redis-applied-ai","download_url":"https://codeload.github.com/redis-applied-ai/redis-vector-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-applied-ai%2Fredis-vector-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405359,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-13T23:47:53.545Z","updated_at":"2026-01-13T23:47:53.594Z","avatar_url":"https://github.com/redis-applied-ai.png","language":"PHP","funding_links":[],"categories":["Embeddings \u0026 Vector Search","Vector Storage \u0026 RAG"],"sub_categories":["Tokenizers \u0026 Prompt Utilities","Utilities \u0026 Tools"],"readme":"## Introduction ##\n\nThe Redis Vector Library (RedisVL) is a PHP client for AI applications leveraging Redis.\n\nDesigned for:\n- Vector similarity search\n- Recommendation engine\n\nA perfect tool for Redis-based applications, incorporating capabilities like vector-based semantic search,\nfull-text search, and geo-spatial search.\n\n## Getting started ##\n\n### Installation ###\n```shell\ncomposer install redis-ventures/redisvl\n```\n\n### Setting up Redis ####\n\nChoose from multiple Redis deployment options:\n1. [Redis Cloud](https://redis.com/try-free/): Managed cloud database (free tier available)\n2. [Redis Stack](https://redis.io/docs/install/install-stack/docker/): Docker image for development\n```shell\ndocker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest\n```\n3. [Redis Enterprise](https://redis.com/redis-enterprise/advantages/): Commercial, self-hosted database\n\n## What's included? ##\n\n### Redis index management ###\n\n1. Design your schema that models your dataset with one of the available Redis data structures (HASH, JSON)\nand indexable fields (e.g. text, tags, numerics, geo, and vectors).\n\nLoad schema as a dictionary:\n```php\n$schema = [\n    'index' =\u003e [\n        'name' =\u003e 'products',\n        'prefix' =\u003e 'product:',\n        'storage_type' =\u003e 'hash',\n    ],\n    'fields' =\u003e [\n        'id' =\u003e [\n            'type' =\u003e 'numeric',\n        ],\n        'categories' =\u003e [\n            'type' =\u003e 'tag',\n        ],\n        'description' =\u003e [\n            'type' =\u003e 'text',\n        ],\n        'description_embedding' =\u003e [\n             'type' =\u003e 'vector',\n             'dims' =\u003e 3,\n             'datatype' =\u003e 'float32',\n             'algorithm' =\u003e 'flat',\n             'distance_metric' =\u003e 'cosine'\n        ],\n    ],\n];\n```\n2. Create a SearchIndex object with an input schema and client connection to be able to interact with your Redis index\n```php\nuse Predis\\Client;\nuse RedisVentures\\RedisVl\\Index\\SearchIndex;\n\n$client = new Client();\n$index = new SearchIndex($client, $schema);\n\n// Creates index in the Redis\n$index-\u003ecreate();\n```\n3. Load/fetch your data from index. If you have a hash index data should be loaded as key-value pairs\n, for json type data loads as json string.\n```php\n$data = ['id' =\u003e '1', 'count' =\u003e 10, 'id_embeddings' =\u003e VectorHelper::toBytes([0.000001, 0.000002, 0.000003])];\n\n// Loads given dataset associated with given key.\n$index-\u003eload('key', $data);\n\n// Fetch dataset corresponding to given key\n$index-\u003efetch('key');\n```\n\n### Realtime search ###\n\nDefine queries and perform advanced search over your indices, including combination of vectors and variety of filters.\n\n**VectorQuery** - flexible vector-similarity semantic search with customizable filters\n```php\nuse RedisVentures\\RedisVl\\Query\\VectorQuery;\n\n$query = new VectorQuery(\n    [0.001, 0.002, 0.03],\n    'description_embedding',\n    null,\n    3\n);\n\n// Run vector search against vector field specified in schema.\n$results = $index-\u003equery($query);\n```\n\nIncorporate complex metadata filters on your queries:\n```php\nuse RedisVentures\\RedisVl\\Query\\Filter\\TagFilter;\nuse RedisVentures\\RedisVl\\Enum\\Condition;\n\n$filter = new TagFilter(\n    'categories',\n    Condition::equal,\n    'foo'\n);\n\n$query = new VectorQuery(\n    [0.001, 0.002, 0.03],\n    'description_embedding',\n    null,\n    10,\n    true,\n    2,\n    $filter\n);\n\n// Results will be filtered by tag field values.\n$results = $index-\u003equery($query);\n```\n\n### Filter types ###\n\n#### Numeric ####\n\nNumeric filters could be applied to numeric fields. \nSupports variety of conditions applicable for scalar types (==, !=, \u003c, \u003e, \u003c=, \u003e=).\nMore information [here](https://redis.io/docs/interact/search-and-query/query/range/).\n```php\nuse RedisVentures\\RedisVl\\Query\\Filter\\NumericFilter;\nuse RedisVentures\\RedisVl\\Enum\\Condition;\n\n$equal = new NumericFilter('numeric', Condition::equal, 10);\n$notEqual = new NumericFilter('numeric', Condition::notEqual, 10);\n$greaterThan = new NumericFilter('numeric', Condition::greaterThan, 10);\n$greaterThanOrEqual = new NumericFilter('numeric', Condition::greaterThanOrEqual, 10);\n$lowerThan = new NumericFilter('numeric', Condition::lowerThan, 10);\n$lowerThanOrEqual = new NumericFilter('numeric', Condition::lowerThanOrEqual, 10);\n```\n\n#### Tag ####\n\nTag filters could be applied to tag fields. Single or multiple values can be provided, single values supports only \nequality conditions (==, !==), for multiple tags additional conjunction (AND, OR) could be specified.\nMore information [here](https://redis.io/docs/interact/search-and-query/advanced-concepts/tags/)\n```php\nuse RedisVentures\\RedisVl\\Query\\Filter\\TagFilter;\nuse RedisVentures\\RedisVl\\Enum\\Condition;\nuse RedisVentures\\RedisVl\\Enum\\Logical;\n\n$singleTag = new TagFilter('tag', Condition::equal, 'value')\n$multipleTags = new TagFilter('tag', Condition::notEqual, [\n    'conjunction' =\u003e Logical::or,\n    'tags' =\u003e ['value1', 'value2']\n])\n```\n\n#### Text ####\n\nText filters could be applied to text fields. Values can be provided as a single word or multiple words with\nspecified condition. Empty value corresponds to all values (*). \nMore information [here](https://redis.io/docs/interact/search-and-query/query/full-text/)\n```php\nuse RedisVentures\\RedisVl\\Query\\Filter\\TextFilter;\nuse RedisVentures\\RedisVl\\Enum\\Condition;\n\n$single = new TextFilter('text', Condition::equal, 'foo');\n\n// Matching foo AND bar\n$multipleAnd = new TextFilter('text', Condition::equal, 'foo bar');\n\n// Matching foo OR bar\n$multipleOr = new TextFilter('text', Condition::equal, 'foo|bar');\n\n// Perform fuzzy search\n$fuzzy = new TextFilter('text', Condition::equal, '%foobaz%');\n```\n\n#### Geo ####\n\nGeo filters could be applied to geo fields. Supports only equality conditions, \nvalue should be specified as specific-shape array. \nMore information [here](https://redis.io/docs/interact/search-and-query/query/geo-spatial/)\n```php\nuse RedisVentures\\RedisVl\\Query\\Filter\\GeoFilter;\nuse RedisVentures\\RedisVl\\Enum\\Condition;\nuse RedisVentures\\RedisVl\\Enum\\Unit;\n\n$geo = new GeoFilter('geo', Condition::equal, [\n    'lon' =\u003e 10.111,\n    'lat' =\u003e 11.111,\n    'radius' =\u003e 100,\n    'unit' =\u003e Unit::kilometers\n]);\n```\n\n#### Aggregate ####\n\nTo apply multiple filters to a single query use AggregateFilter. \nIf there's the same logical operator that should be applied for each filter you can pass values in constructor,  \nif you need a specific combination use `and()` and `or()` methods to create combined filter.\n```php\nuse RedisVentures\\RedisVl\\Query\\Filter\\AggregateFilter;\nuse RedisVentures\\RedisVl\\Query\\Filter\\TextFilter;\nuse RedisVentures\\RedisVl\\Query\\Filter\\NumericFilter;\nuse RedisVentures\\RedisVl\\Enum\\Condition;\nuse RedisVentures\\RedisVl\\Enum\\Logical;\n\n$aggregate = new AggregateFilter([\n    new TextFilter('text', Condition::equal, 'value'),\n    new NumericFilter('numeric', Condition::greaterThan, 10)\n], Logical::or);\n\n$combinedAggregate = new AggregateFilter();\n$combinedAggregate\n    -\u003eand(\n        new TextFilter('text', Condition::equal, 'value'),\n        new NumericFilter('numeric', Condition::greaterThan, 10)\n    )-\u003eor(\n        new NumericFilter('numeric', Condition::lowerThan, 100)\n    );\n```\n\n## Vectorizers ##\n\nTo be able to effectively create vector representations for your indexed data or queries, you have to use \n[LLM's](https://en.wikipedia.org/wiki/Large_language_model). There's a variety of vectorizers that provide integration\nwith popular embedding models.\n\nThe only required option is your API key specified as environment variable or configuration option.\n\n### OpenAI ###\n```php\nuse RedisVentures\\RedisVl\\Vectorizer\\Factory;\n\nputenv('OPENAI_API_TOKEN=your_token');\n\n$factory = new Factory();\n$vectorizer = $factory-\u003ecreateVectorizer('openai');\n\n// Creates vector representation of given text.\n$embedding = $vectorizer-\u003eembed('your_text')\n\n// Creates a single vector representation from multiple chunks.\n$mergedEmbedding = $vectorizer-\u003ebatchEmbed(['first_chunk', 'second_chunk']);\n```\n\n### VectorHelper ###\n\nWhen you perform vector queries against Redis or load hash data into index that contains vector field data, \nyour vector should be represented as a blob string. VectorHelper allows you to create\nblob representation from your vector represented as array of floats.\n```php\nuse RedisVentures\\RedisVl\\VectorHelper;\n\n$blobVector = VectorHelper::toBytes([0.001, 0.002, 0.003]);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-applied-ai%2Fredis-vector-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredis-applied-ai%2Fredis-vector-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-applied-ai%2Fredis-vector-php/lists"}