{"id":24612704,"url":"https://github.com/upstash/vector-php","last_synced_at":"2025-05-06T21:48:19.714Z","repository":{"id":272598112,"uuid":"911150411","full_name":"upstash/vector-php","owner":"upstash","description":"Upstash Vector Database PHP Client, Upsert, Query and Range vectors","archived":false,"fork":false,"pushed_at":"2025-04-28T05:25:36.000Z","size":188,"stargazers_count":6,"open_issues_count":3,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-30T22:16:51.207Z","etag":null,"topics":["ai","php","sdk","sdk-php","semantic-search","upstash","upstash-vector","vector","vector-database"],"latest_commit_sha":null,"homepage":"https://upstash.com/docs/vector/overall/getstarted","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/upstash.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"publiccode":null,"codemeta":null}},"created_at":"2025-01-02T11:02:17.000Z","updated_at":"2025-04-22T20:46:21.000Z","dependencies_parsed_at":"2025-01-15T14:32:10.870Z","dependency_job_id":"fcc28986-18a6-4e63-acfb-666c884858b6","html_url":"https://github.com/upstash/vector-php","commit_stats":null,"previous_names":["upstash/vector-php"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upstash%2Fvector-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upstash%2Fvector-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upstash%2Fvector-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upstash%2Fvector-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/upstash","download_url":"https://codeload.github.com/upstash/vector-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252776480,"owners_count":21802462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ai","php","sdk","sdk-php","semantic-search","upstash","upstash-vector","vector","vector-database"],"created_at":"2025-01-24T20:25:04.437Z","updated_at":"2025-05-06T21:48:19.702Z","avatar_url":"https://github.com/upstash.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vector Client SDK for PHP\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/upstash/vector.svg?style=flat-square)](https://packagist.org/packages/upstash/vector)\n[![Tests](https://img.shields.io/github/actions/workflow/status/upstash/vector-php/run-tests.yml?branch=master\u0026label=tests\u0026style=flat-square)](https://github.com/upstash/vector-php/actions/workflows/run-tests.yml)\n[![Total Downloads](https://img.shields.io/packagist/dt/upstash/vector.svg?style=flat-square)](https://packagist.org/packages/upstash/vector)\n\nUpstash Vector is an HTTP serverless Vector Database.\n\nYou can store, query, and retrieve vectors from your application, use it to power your search, and more.\n\nYou can read more about Upstash Vector [here](https://docs.upstash.com/vector).\n\n## Quick Start\n\n### Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require upstash/vector\n```\n\n### Create Index\n\nCreate a new index on [Upstash](https://console.upstash.com/vector)\n\n## Usage\n\n### Initialize the index\n```php\nuse Upstash\\Vector\\Index;\n\n// Initialize the index\n$index = new Index(\n    url: 'UPSTASH_VECTOR_REST_URL',\n    token: 'UPSTASH_VECTOR_REST_TOKEN',\n);\n\n// or just to use the environment variables\n$index = Index::fromEnv();\n```\n\n### Upserting Vectors\n\n\n```php\nuse Upstash\\Vector\\Index;\nuse Upstash\\Vector\\VectorUpsert;\n\nuse function Upstash\\Vector\\createRandomVector;\n\n$index = new Index(\n    url: 'UPSTASH_VECTOR_REST_URL',\n    token: 'UPSTASH_VECTOR_REST_TOKEN',\n);\n\n$index-\u003eupsert(new VectorUpsert(\n    id: 'upstash-rocks',\n    vector: createRandomVector(dimensions: 1536),\n    metadata: ['field' =\u003e 'value'],\n));\n```\n\n### Upserting Data with Embedding Models\n\n```php\nuse Upstash\\Vector\\Index;\nuse Upstash\\Vector\\DataUpsert;\n\n$index = new Index(\n    url: 'UPSTASH_VECTOR_REST_URL',\n    token: 'UPSTASH_VECTOR_REST_TOKEN',\n);\n\n$index-\u003eupsertData(new DataUpsert(\n    id: 'upstash-vector',\n    data: 'Upstash Vector is a serverless vector database.',\n    metadata: ['field' =\u003e 'value'],\n));\n```\n\n### Querying Vectors\n\n```php\nuse Upstash\\Vector\\Index;\nuse Upstash\\Vector\\VectorQuery;\n\nuse function Upstash\\Vector\\createRandomVector;\n\n$index = new Index(\n    url: 'UPSTASH_VECTOR_REST_URL',\n    token: 'UPSTASH_VECTOR_REST_TOKEN',\n);\n\n$index-\u003equery(new VectorQuery(\n    vector: createRandomVector(dimensions: 1536),\n    topK: 5,\n));\n```\n\n### Querying Data with Embedding Models\n\n```php\nuse Upstash\\Vector\\Index;\nuse Upstash\\Vector\\DataQuery;\n\n$index = new Index(\n    url: 'UPSTASH_VECTOR_REST_URL',\n    token: 'UPSTASH_VECTOR_REST_TOKEN',\n);\n\n$index-\u003equeryData(new DataQuery(\n    data: 'What is Upstash Vector?',\n    topK: 5,\n));\n```\n\n### Fetch specific vectors\n\n```php\nuse Upstash\\Vector\\Index;\nuse Upstash\\Vector\\VectorFetch;\n\n$index = new Index(\n    url: 'UPSTASH_VECTOR_REST_URL',\n    token: 'UPSTASH_VECTOR_REST_TOKEN',\n);\n\n$index-\u003efetch(new VectorFetch(ids: ['upstash-rocks']));\n```\n\n### Delete specific vectors\n\n```php\nuse Upstash\\Vector\\Index;\n\n$index = new Index(\n    url: 'UPSTASH_VECTOR_REST_URL',\n    token: 'UPSTASH_VECTOR_REST_TOKEN',\n);\n\n$index-\u003edelete(['upstash-rocks']);\n```\n\n## Namespaces\nUpstash Vector allows you to partition a single index into multiple isolated namespaces. Each namespace functions as a self-contained subset of the index, in which read and write requests are only limited to one namespace. To learn more about it, [see Namespaces](https://upstash.com/docs/vector/features/namespaces).\n\n### Example\n```php\nuse Upstash\\Vector\\Index;\nuse Upstash\\Vector\\VectorUpsert;\n\nuse function Upstash\\Vector\\createRandomVector;\n\n$index = new Index(\n    url: 'UPSTASH_VECTOR_REST_URL',\n    token: 'UPSTASH_VECTOR_REST_TOKEN',\n);\n\n// Upsert to namespace\n$index-\u003enamespace('books')-\u003eupsert(new VectorUpsert(\n    id: 'upstash-rocks',\n    vector: createRandomVector(dimensions: 1536),\n    metadata: ['field' =\u003e 'value'],\n));\n```\n\n## Troubleshooting\n\nWe have a [Discord](upstash.com/discord) for common problems. If you can't find a solution, please [open an issue](https://github.com/upstash/vector-js/issues/new).\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupstash%2Fvector-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fupstash%2Fvector-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupstash%2Fvector-php/lists"}