PHPackages                             marko/docs-vec - 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. [Search &amp; Filtering](/categories/search)
4. /
5. marko/docs-vec

Abandoned → [marko/docs-fts](/?search=marko%2Fdocs-fts)Marko-module[Search &amp; Filtering](/categories/search)

marko/docs-vec
==============

Hybrid FTS5 + sqlite-vec semantic search driver for Marko documentation

0.8.1(1mo ago)01MITPHPPHP ^8.5

Since May 29Pushed 1mo agoCompare

[ Source](https://github.com/marko-php/marko-docs-vec)[ Packagist](https://packagist.org/packages/marko/docs-vec)[ RSS](/packages/marko-docs-vec/feed)WikiDiscussions develop Synced 1w ago

READMEChangelogDependencies (10)Versions (4)Used By (0)

marko/docs-vec
==============

[](#markodocs-vec)

Hybrid FTS5 + sqlite-vec semantic documentation search driver for Marko — combines keyword and vector search for best-in-class relevance.

Overview
--------

[](#overview)

`marko/docs-vec` implements `DocsSearchInterface` using both SQLite FTS5 (keyword) and `sqlite-vec` (vector embeddings) with ONNX Runtime for local inference via `codewithkyrian/transformers`. Results are fused (reciprocal-rank fusion) across BM25 keyword ranking and cosine similarity, giving accurate answers even when the query wording differs from the documentation. When the `sqlite-vec` extension, the model, or `transformers` is unavailable — or the PHP build can't load SQLite extensions — it falls back to FTS5-only keyword search using its own built-in index. Use `marko/docs-fts` instead if you only want lightweight keyword search.

Installation
------------

[](#installation)

```
composer require marko/docs-vec
```

That alone gives you working FTS5-only search. For full hybrid semantic search, add the ONNX runtime and fetch the native extension and model:

```
composer require codewithkyrian/transformers   # ^0.6 with symfony 8 (^0.5 with symfony 6/7)
marko docs-vec:download-extension              # sqlite-vec native binary for this platform
marko docs-vec:download-model                  # bge-small-en-v1.5 ONNX model
marko docs-vec:build                           # build the hybrid index
```

> **Graceful fallback.** Every piece above is optional: if the extension, model, or `transformers` is missing (or PHP can't load SQLite extensions), `build` and `search`degrade to FTS5-only instead of failing. `marko docs-vec:build` reports which mode it used.

The sqlite-vec extension
------------------------

[](#the-sqlite-vec-extension)

Vector search loads the native [`sqlite-vec`](https://github.com/asg017/sqlite-vec) extension via PHP's `Pdo\Sqlite::loadExtension()` (not a `SELECT load_extension(...)` SQL call, which SQLite blocks by default). Fetch a pinned, checksum-verified build for your platform:

```
marko docs-vec:download-extension
```

Ships `sqlite-vec` builds for macOS, Linux, and Windows (x86\_64 / arm64), written to `resources/sqlite-vec/` (gitignored). Mirror/firewall override: `--base-url=`.

ONNX model
----------

[](#onnx-model)

This package uses the **bge-small-en-v1.5** model (~130MB across `onnx/model.onnx` plus `config.json`, `tokenizer.json`, `tokenizer_config.json`, and `special_tokens_map.json`) for semantic embeddings. The files use the HuggingFace layout transformers-php expects. The model is **not** committed to the repository — it is downloaded on demand and verified by SHA-256.

### Downloading the model

[](#downloading-the-model)

```
marko docs-vec:download-model
```

Files are written into the package at `resources/models/bge-small-en-v1.5/` (gitignored). The download is pinned to a specific HuggingFace commit and each file's SHA-256 is verified. Behind a firewall or using a mirror? Pass `--base-url=`:

```
marko docs-vec:download-model --base-url=https://my-mirror.example.com/bge-small-en-v1.5
```

`marko docs-vec:build` fails loudly with a pointer to this command if the model is missing.

### Why not bundled?

[](#why-not-bundled)

The model is ~130MB — too large to commit to a Composer package. If you only need keyword search (no semantic/vector ranking), use the lighter `marko/docs-fts` driver instead, which needs no model.

### Platform support

[](#platform-support)

The ONNX runtime supports Linux (x64, ARM64), macOS (x64, ARM64), and Windows (x64). On unsupported platforms, or when the model has not been downloaded, `docs-vec` falls back to FTS5-only keyword search (no semantic ranking) using its own built-in index — it does not depend on the `marko/docs-fts` package.

Usage
-----

[](#usage)

`module.php` binds `DocsSearchInterface` to `VecSearch` automatically. After fetching the extension and model, build the index, then inject the contract and search:

```
marko docs-vec:download-extension
marko docs-vec:download-model
marko docs-vec:build
```

Documentation
-------------

[](#documentation)

Full configuration, ranking details, and the docs-driver comparison: [marko/docs-vec](https://marko.build/docs/packages/docs-vec/)

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance94

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~25 days

Total

2

Last Release

31d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/437029?v=4)[Mark Shust](/maintainers/markshust)[@markshust](https://github.com/markshust)

---

Top Contributors

[![markshust](https://avatars.githubusercontent.com/u/437029?v=4)](https://github.com/markshust "markshust (3 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/marko-docs-vec/health.svg)

```
[![Health](https://phpackages.com/badges/marko-docs-vec/health.svg)](https://phpackages.com/packages/marko-docs-vec)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
