upstash/vector-laravel is a dedicated Laravel SDK for Upstash Vector, that is built on top of our official PHP SDK.
By using upstash/vector-laravel you will be able to:
- Integrate Upstash Vector by only installing the package and setting environment variables.
- A native Vector facade to interact with your vector database.
- Able to maintain multiple index connections in your application.
Install
To install the SDK, you can use composer:composer
Setup
There are two pieces of configuration required to use the Upstash vector client: a REST token and REST URL. These values can be passed using environment variables or in code through the initialization of the Index. Find your configuration values in the console dashboard at https://console.upstash.com/.Usage
Our Laravel SDK will configure your index into the Laravel Service Container. You can access it by calling theVector facade
or by injecting the IndexInterface into your controllers.
Vector Facade
When these environment variables are set, you can start using your Index by calling theVector facade.
Dependency Injection
If you prefer to avoid using the facade, you can inject theIndexInterface into your controllers.
Configuration
You can also configure the SDK to be able to use multiple indexes in your application. For doing that you can publish the configuration file by running the following command:config/vector.php that you can edit to add your indexes.
Multiple Connections
If you want to use multiple connections in your application, you can add them to theconnections array as shown below:
connection method: