Download the PHP package displace/ext-turbovec without Composer

On this page you can find all versions of the php package displace/ext-turbovec. 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 ext-turbovec

ext-turbovec

Native vector search for PHP, in-process.
Quantized ANN indexing over millions of embeddings — no vector database, no sidecar, no remote API.

CI Latest release PHP 8.3 / 8.4 / 8.5 Pre-release Documentation


What is ext-turbovec?

ext-turbovec is a PHP 8.3+ extension for in-process vector indexing and approximate-nearest-neighbor search. It is the retrieval half of a fully local RAG stack for PHP: ext-infer generates the embeddings, ext-turbovec indexes and searches them. No Python sidecar, no vector database, no data leaving the machine.

Under the hood it binds the turbovec Rust crate by Ryan Codrai — an implementation of Google Research's TurboQuant quantization algorithm (Gollapudi et al., arXiv:2504.19874): data-oblivious 2–4-bit compression with near-optimal distortion, no training phase, and SIMD search kernels (NEON on ARM, AVX2/AVX-512BW on x86) that beat FAISS IndexPQFastScan on most configurations. All credit for the index engine goes upstream — this extension is a downstream bindings consumer, not a fork.

Quick start

Pair it with ext-infer for end-to-end semantic search — see examples/semantic-search.php, or examples/basic-search.php for a standalone, model-free walkthrough.

The packed-vector contract

Index methods accept vectors as packed little-endian float32 binary strings — exactly what PHP's pack() produces with the g format code:

strlen($payload) must be a whole multiple of 4 * $dim; anything else throws DimensionMismatchException. This is deliberately the only input path — packed strings cross the FFI boundary as a single memcpy-sized blob instead of millions of PHP zvals, and it's the format ext-infer's EmbeddingModel will emit natively in its next release. For array-minded code, Vectors::pack(array $floats): string and Vectors::unpack(string $packed, int $dim): array are the on-ramp.

Memory math

The index stores bitWidth bits per coordinate plus one float32 scale per vector. For 100,000 documents at dim 1024 with 4-bit quantization:

bitWidth: 2 halves the codes again when recall requirements allow. dim must be a positive multiple of 8 (every common embedding size qualifies: 384, 512, 768, 1024, 1536, 3072, 4096, …).

API surface (v0.1)

Class Methods
Displace\Vector\TurboQuantIndex __construct(int $dim, int $bitWidth = 4) · add(string $vectors) · count() · search(string $query, int $k = 10): SearchResult · write(string $path) · static load(string $path)
Displace\Vector\IdMapIndex as above, plus addWithIds(string $vectors, array $ids) · search(string $query, int $k = 10, ?array $allowlist = null) · remove(int $id)
Displace\Vector\SearchResult ids(): array · scores(): array · count(): int · Countable · IteratorAggregate yielding ['id' => int, 'score' => float]
Displace\Vector\Vectors static pack(array $floats): string · static unpack(string $packed, int $dim): array

Exceptions: VectorException (extends \RuntimeException) with InvalidArgumentException, DimensionMismatchException, and IndexIOException beneath it. Full reference with semantics at turbovec.displace.tech.

Compatibility

macOS arm64 Linux x86_64 Linux arm64 Windows
PHP 8.3 ✅ ✅ ✅ —
PHP 8.4 ✅ ✅ ✅ —
PHP 8.5 ✅ ✅ ✅ —

CPU-only by design. On x86_64 the AVX-512BW kernel engages automatically when the CPU has it, with an AVX2 fallback (Haswell 2013+) below it. Linux note: the upstream engine links OpenBLAS — binaries need the libopenblas0 package at runtime (libopenblas-dev to build from source). macOS uses the built-in Accelerate framework; nothing to install.

This release pins upstream turbovec 0.9.0. The pin is exact because the on-disk index formats must stay stable; upstream bumps are deliberate, documented events (see RELEASE.md).

Roadmap

Shipped (v0.1)   TurboQuantIndex · IdMapIndex with allowlist filtering and O(1) remove · packed-vector fast path · Vectors helpers · write/load persistence · typed exceptions · PHPT suite · CI matrix · PIE-compatible binary releases.

Next (v0.2)   batch search (multi-query in one call) · mmap-backed load() · range/threshold search · zero-copy packed handoff from ext-infer's EmbeddingModel.

Deliberately out of scope   Windows · GPU · graph indexes (HNSW-style) — TurboQuant's flat quantized scan is the sweet spot this extension is built around.

License

MIT © 2026 Eric Mann / Displace Technologies. Bundles turbovec © Ryan Codrai, MIT — see THIRD-PARTY-NOTICES.md. TurboQuant is the work of Gollapudi et al., arXiv:2504.19874.


All versions of ext-turbovec with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 displace/ext-turbovec contains the following files

Loading the files please wait ...