kreuzberg / kreuzberg
High-performance document intelligence for PHP. Extract text, metadata, and structured information from PDFs, Office documents, images, and 75 formats. Powered by Rust core for 10-50x speed improvements.
Package info
github.com/kreuzberg-dev/kreuzberg-lts
Language:Rust
Type:php-ext
Ext name:ext-kreuzberg
pkg:composer/kreuzberg/kreuzberg
Requires
- php: ^8.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^13.1
Replaces
- ext-kreuzberg: *
This package is auto-updated.
Last update: 2026-07-12 12:26:38 UTC
README
Note
Kreuzberg v4 LTS — the long-term-support line for Kreuzberg v4. Active development has moved to Xberg (v5+). This repository receives critical bug and security fixes until the end of 2026, on a best-effort basis. New features land in Xberg. See the migration guide & LTS policy →
Extract text, metadata, and code intelligence from 97+ file formats and 300+ programming languages at native speeds without needing a GPU.
Key Features
- Code intelligence – Functions, classes, imports, symbols, and docstrings from 248 programming languages via tree-sitter, with semantic chunking
- 91+ file formats – PDF, Office documents, images, HTML/XML, emails, archives, and academic formats across 8 categories
- Polyglot – Native bindings for Rust, Python, TypeScript/Node.js, Ruby, Go, Java, C#, PHP, Elixir, R, and C
- LLM intelligence – VLM OCR, schema-constrained JSON extraction, and provider-hosted embeddings across 146 LLM providers (including local engines) via liter-llm
- OCR support – Tesseract (incl. WASM), PaddleOCR, EasyOCR (Python), and VLM OCR; extensible via plugin API
- High performance – Rust core with native PDFium, SIMD, full parallelism, and streaming parsers for multi-GB files
- Flexible deployment – Library, CLI, REST API server, or MCP server
- GFM-quality output – Comrak rendering with cross-format parity (Markdown, HTML, Djot, Plain) plus token-efficient TOON serialization
Documentation | Live Demo | Installation
Installation
Each language binding provides comprehensive documentation with examples and best practices. Choose your platform to get started:
Scripting Languages:
- Python – PyPI package, async/sync APIs, OCR backends (Tesseract, PaddleOCR, EasyOCR)
- Ruby – RubyGems package, idiomatic Ruby API, native bindings
- PHP – Composer package, modern PHP 8.4+ support, type-safe API, async extraction
- Elixir – Hex package, OTP integration, concurrent processing
- R – r-universe package, idiomatic R API, extendr bindings
JavaScript/TypeScript:
- @kreuzberg/node – Native NAPI-RS bindings for Node.js/Bun, fastest performance
- @kreuzberg/wasm – WebAssembly for browsers/Deno/Cloudflare Workers, full feature parity (PDF, Excel, OCR, archives)
Compiled Languages:
- Go – Go module with FFI bindings, context-aware async
- Java – Maven Central, Foreign Function & Memory API
- C# – NuGet package, .NET 6.0+, full async/await support
Native:
- Rust – Core library, flexible feature flags, zero-copy APIs
- C (FFI) – C header + shared library, pkg-config/CMake support, cross-platform
Containers:
- Docker – Official images with API, CLI, and MCP server modes (Core: ~1.0-1.3GB, Full: ~1.0-1.3GB with OCR + legacy format support)
Command-Line:
- CLI – Cross-platform binary, batch processing, MCP server mode
All language bindings include precompiled binaries for both x86_64 and aarch64 architectures on Linux and macOS.
Platform Support
Complete architecture coverage across all language bindings:
| Language | Linux x86_64 | Linux aarch64 | macOS ARM64 | Windows x64 |
|---|---|---|---|---|
| Python | ✅ | ✅ | ✅ | ✅ |
| Node.js | ✅ | ✅ | ✅ | ✅ |
| WASM | ✅ | ✅ | ✅ | ✅ |
| Ruby | ✅ | ✅ | ✅ | - |
| R | ✅ | ✅ | ✅ | ✅ |
| Elixir | ✅ | ✅ | ✅ | ✅ |
| Go | ✅ | ✅ | ✅ | ✅ |
| Java | ✅ | ✅ | ✅ | ✅ |
| C# | ✅ | ✅ | ✅ | ✅ |
| PHP | ✅ | ✅ | ✅ | ✅ |
| Rust | ✅ | ✅ | ✅ | ✅ |
| C (FFI) | ✅ | ✅ | ✅ | ✅ |
| CLI | ✅ | ✅ | ✅ | ✅ |
| Docker | ✅ | ✅ | ✅ | - |
Note: ✅ = Precompiled binaries available with instant installation. WASM runs in any environment with WebAssembly support (browsers, Deno, Bun, Cloudflare Workers). All platforms are tested in CI. MacOS support is Apple Silicon only.
Embeddings Support (Optional)
Embeddings require ONNX Runtime 1.24+ (brew install onnxruntime, or download a release). All other features work without it. See the Embeddings Guide.
Supported Formats
91+ file formats across 8 categories with intelligent format detection and comprehensive metadata extraction:
- Office – Word (
.docx/.odt/.pages), spreadsheets (.xlsx/.ods/.numbers), presentations (.pptx/.key),.pdf, eBooks (.epub/.fb2),.dbf, Hangul (.hwp/.hwpx) - Images (OCR) –
.png/.jpg/.gif/.webp/.bmp/.tiff, advanced (.jp2/.jbig2/.pnmvia pure-Rust decoders), and.svg - Web & Data –
.html/.xml, structured data (.json/.yaml/.toml/.csv), and text/markup (.md/.djot/.rst/.org/.rtf) - Email & Archives –
.eml/.msg, and.zip/.tar/.gz/.7zwith recursive extraction - Academic & Scientific – citations (
.bib/.ris/.nbib/.csl),.tex/.typ/.jats/.ipynb, and publishing/documentation formats (.docbook/.opml/.pod/.troff)
Code Intelligence (248 Languages)
Extract structure (functions, classes, imports, symbols), parse docstrings (Google, NumPy, Sphinx, JSDoc, RustDoc, +10 more), and split code by semantic boundaries. Powered by tree-sitter-language-pack with dynamic grammar download — see the TSLP documentation for the full language list.
AI Coding Assistants
Kreuzberg ships with an Agent Skill that teaches AI coding assistants how to use the library correctly. It works with Claude Code, Codex, Gemini CLI, Cursor, VS Code, Amp, Goose, Roo Code, and any tool supporting the Agent Skills standard.
Install the skill into any project using the Vercel Skills CLI:
npx skills add kreuzberg-dev/kreuzberg-lts
The skill is located at skills/kreuzberg/SKILL.md and is automatically discovered by supported AI coding tools once installed.
Documentation
- Installation Guide – Setup and dependencies
- User Guide – Comprehensive usage guide
- API Reference – Complete API documentation
- Format Support – Supported file formats
- OCR Backends – OCR engine setup
- CLI Guide – Command-line usage
- Migration Guides – Upgrading from other libraries
Part of Xberg.io
Kreuzberg v4 LTS is the legacy line of the document-intelligence library now developed as Xberg. It is one of the open-source projects from Kreuzberg, Inc.:
- Xberg — document intelligence: text, tables, metadata from 91+ formats with optional OCR (the active successor to Kreuzberg).
- Xberg Enterprise — managed extraction API with SDKs, dashboards, and observability.
- crawlberg — web crawling and scraping with HTML→Markdown and headless-Chrome fallback.
- html-to-markdown — fast, lossless HTML→Markdown engine.
- liter-llm — universal LLM API client with native bindings for 14 languages and 143 providers.
- tree-sitter-language-pack — tree-sitter grammars and code-intelligence primitives.
- alef — the polyglot binding generator that produces every per-language binding across the polyglot repos.
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
License
MIT License - see LICENSE for details.