PHPackages                             displace/ext-turbovec - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. displace/ext-turbovec

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

displace/ext-turbovec
=====================

PHP 8.3+ native, in-process vector indexing and ANN search via TurboQuant.

v0.1.0(1mo ago)31MITRustPHP ^8.3CI passing

Since Jun 11Pushed 1mo agoCompare

[ Source](https://github.com/DisplaceTech/ext-turbovec)[ Packagist](https://packagist.org/packages/displace/ext-turbovec)[ Docs](https://github.com/DisplaceTech/ext-turbovec)[ RSS](/packages/displace-ext-turbovec/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

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](https://github.com/DisplaceTech/ext-turbovec/actions/workflows/ci.yml/badge.svg)](https://github.com/DisplaceTech/ext-turbovec/actions/workflows/ci.yml) [![Latest release](https://camo.githubusercontent.com/b8bf6d03ef61baddaeb47ed54c3ba6a838fbe4d194e30176f9f0fb806c024dad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f446973706c616365546563682f6578742d747572626f7665633f736f72743d73656d76657226696e636c7564655f70726572656c6561736573)](https://github.com/DisplaceTech/ext-turbovec/releases/latest) [![PHP 8.3 / 8.4 / 8.5](https://camo.githubusercontent.com/f8c66ec3458748baee370b7844203c334e62735196a3c31b11c504ab609f4be7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e33253230253743253230382e34253230253743253230382e352d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/f8c66ec3458748baee370b7844203c334e62735196a3c31b11c504ab609f4be7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e33253230253743253230382e34253230253743253230382e352d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465) [![Pre-release](https://camo.githubusercontent.com/9f096097aa41a5a065f1cfb6503ce800e794f0734b4ab8dc18231d463db099c5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5374617475732d7072652d2d72656c656173652d6f72616e6765)](https://camo.githubusercontent.com/9f096097aa41a5a065f1cfb6503ce800e794f0734b4ab8dc18231d463db099c5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5374617475732d7072652d2d72656c656173652d6f72616e6765) [![MIT License](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](LICENSE) [![Documentation](https://camo.githubusercontent.com/7272da417a5022ed1ff18b0c7282c81e8dcf1ce565fccb11f32cd5781a7ad5f3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d747572626f7665632e646973706c6163652e746563682d626c7565)](https://turbovec.displace.tech)

---

What is ext-turbovec?
---------------------

[](#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](https://github.com/DisplaceTech/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`](https://github.com/RyanCodrai/turbovec)Rust crate by Ryan Codrai — an implementation of Google Research's **TurboQuant** quantization algorithm ([Gollapudi et al., arXiv:2504.19874](https://arxiv.org/abs/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.

- 🗜️ **4-bit vectors** — a 10M-document corpus that needs 31 GB as float32 fits in ~4 GB.
- ➕ **Online ingest** — add vectors and they're searchable; no train step, no rebuilds.
- 🔍 **Filtered search** — pass an id allowlist and the SIMD kernel honors it directly; selective filters get *faster*, not less accurate.
- 🆔 **Stable ids** — `IdMapIndex` addresses vectors by your own uint64 ids (SQL primary keys), with O(1) `remove()`.
- 💾 **Persistence** — versioned on-disk formats (`.tv` / `.tvim`) that round-trip search results bit-exactly.
- ⚡ **In-process** — search latency is the kernel time; there's no IPC or network in the loop.

Quick start
-----------

[](#quick-start)

```
pie install displace/ext-turbovec      # or: make build && php -d extension=...
```

```
