Download the PHP package centamiv/vektor without Composer

On this page you can find all versions of the php package centamiv/vektor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package vektor

Vektor - Native PHP Vector Database

Vektor is a high-performance, purely file-based, embedded Vector Database written entirely in native PHP. It is designed for Zero-RAM Overhead, meaning it does not require loading your entire dataset into memory to function.

Each Vektor instance operates as a standalone database, with data stored by default in the /data directory.

Instead of memory-heavy indexes, Vektor utilizes strict binary file layouts and optimized disk-seeking strategies to perform Approximate Nearest Neighbor (ANN) searches using the HNSW (Hierarchical Navigable Small World) algorithm.


Features


Requirements


Upgrading to v2.0.0

⚠️ Important Breaking Change: Version 2.0.0 introduces a change to the binary record length in meta.bin. If you are upgrading from a previous version, your existing data files will be incompatible. You must delete your existing data/ directory and re-index (rebuild) your dataset.


Installation

1. Installation via Composer

To use Vektor in your existing PHP project:

2. Standalone Installation

To run Vektor as a standalone API server:

Ensure the data/ directory is writable by your web server or script user:


Configuration

Vektor uses a .env file for configuration when running as a server.

  1. Copy the example environment file:

  2. Open .env and configure your API Token:

Usage

Vektor is designed for flexibility, allowing you to either integrate it directly into your PHP projects as a library or deploy it as a standalone REST API server.


Usage: HTTP API Server

Vektor includes a built-in Controller to run as a REST API. You can serve this using Apache, Nginx, or the PHP built-in server.

Starting the Server

For testing/development:

Authentication

If VEKTOR_API_TOKEN is set in your .env, you must include the header in all requests:

API Endpoints

GET /up

Health check endpoint.

GET /info

Returns database statistics.

POST /insert

Insert a vector.

POST /search

Search for nearest neighbors.

Optionally pass "include_vector": true to also get vector data of similar documents. Optionally pass "include_metadata": true to also get metadata stored with the document.

POST /delete

Delete a vector.

POST /optimize

Trigger database optimization.


Usage: Embedded Library

You can use Vektor directly in your PHP scripts without running an HTTP server. This is the fastest way to interact with the database.

Configuration

By default, Vektor stores data in the data/ directory relative to the package root. You can change this path using the Config class:

You can also set the vector dimensions (default 1536):

Initialization

1. Inserting Vectors

Vectors must be 1536-dimensional arrays of floats.

2. Searching

Find the k nearest neighbors to a query vector.

3. Deleting Results

Deletes a document by its ID. This performs a "soft delete" in the vector file and updates the metadata mapping.

4. Getting Statistics

Retrieve current database stats, including file sizes and node counts.

5. Optimizing (Vacuum)

Since deletions are "soft", the file size can grow over time. Run the optimizer to rebuild the index and reclaim space. Note: This is a blocking operation.


Database File Structure

Vektor achieves its performance and low memory footprint through three specialized binary files located in the data/ directory.


How to generate embeddings from a document?

Vektor stores vectors, but it does not generate them. You need an embedding model for that. A great local option is Ollama.

  1. Install Ollama and pull an embedding model (e.g., nomic-embed-text).
  2. Use the Ollama API to generate the vector for your text.
  3. Pass that vector to Vektor:

Troubleshooting

1. Permission Denied Errors

Ensure your PHP process (e.g., www-data) has read/write access to the data/ folder and the files inside it.

2. "Invalid Vector Dimensions"

Vektor defaults to 1536 dimensions. If you send a vector with different dimensions, it will be rejected. To change this, you can use VECTOR_DIMENSIONS in your .env or Config::setDimensions(N) in your code. Important: If you change dimensions, you must start with an empty data directory, as the binary file structure depends on the dimension size.

3. Slow Performance?


Contributing

Contributions are welcome! Please run the test suite before submitting a PR.

The test suite includes Unit tests for storage engines and Feature tests for the HNSW logic.


License

This project is licensed under the MIT License.


All versions of vektor with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package centamiv/vektor contains the following files

Loading the files please wait ...