How centamiv/vektor works
Vektor is an embedded PHP vector database with an optional HTTP API. In the main workflow, a client submits a vector to the API controller, which dispatches inserts to the Indexer or searches to the Searcher; the HNSW layer navigates graph connections using cosine similarity, and binary files hold vectors, graph links, ID mappings, and metadata. Delete, statistics, and vacuum optimization are separate capabilities. The README documents health and info endpoints; source excerpts show info but not health handling. Relationships shown are limited to excerpts and explicit README statements; unsampled modules are represented only where documented.
Main entry points: Indexer.php Indexer · Searcher.php Searcher · Optimizer.php Optimizer · HnswLogic.php HNSW logic
Components 13
HTTP API
- HTTP entry
public/index.php - API controller
src/Api/Controller.php
Database services
Search and indexing
- HNSW logic
src/Core/HnswLogic.php - Cosine math
src/Core/Math.php
Binary storage
- Vector file
src/Storage/Binary/VectorFile.php - Graph file
src/Storage/Binary/GraphFile.php - Metadata index
src/Storage/Binary/MetaFile.php - Payload file
src/Storage/Binary/PayloadFile.php
Configuration
- Config
src/Core/Config.php
Other components
- Client
Connections 24
- Client → HTTP entry: sends HTTP
README.md - HTTP entry → API controller: dispatches to
public/index.php - API controller → Indexer: handles writes
src/Api/Controller.php - API controller → Searcher: handles search
src/Api/Controller.php - API controller → Optimizer: triggers vacuum
src/Api/Controller.php - Indexer → HNSW logic: builds links
src/Services/Indexer.php - Searcher → HNSW logic: searches via
src/Services/Searcher.php - HNSW logic → Graph file: reads links
src/Core/HnswLogic.php - HNSW logic → Vector file: reads vectors
src/Core/HnswLogic.php - HNSW logic → Cosine math: scores vectors
src/Core/HnswLogic.php - Indexer → Vector file: appends vectors
src/Services/Indexer.php - Indexer → Graph file: updates graph
src/Services/Indexer.php - Indexer → Metadata index: maps IDs
src/Services/Indexer.php - Indexer → Payload file: stores metadata
src/Services/Indexer.php - Searcher → Vector file: hydrates results
src/Services/Searcher.php - Searcher → Metadata index: finds metadata
src/Services/Searcher.php - Searcher → Payload file: reads metadata
src/Services/Searcher.php - Optimizer → Indexer: rebuilds records
src/Services/Optimizer.php - Optimizer → Vector file: scans records
src/Services/Optimizer.php - Optimizer → Graph file: replaces files
src/Services/Optimizer.php - Optimizer → Metadata index: replaces files
src/Services/Optimizer.php - Optimizer → Payload file: replaces files
src/Services/Optimizer.php - Indexer → Config: reads settings
src/Services/Indexer.php - Searcher → Config: reads settings
src/Services/Searcher.php