quillphp / quill-core
High-performance binary engine for the Quill PHP Framework
Requires
- php: ^8.3
README
Quill-Core
The high-performance native engine behind the Quill PHP Framework.
Quill-Core is the specialized native library that offloads heavy lifting from PHP userland to a thread-safe, memory-safe Rust engine. Built for sub-microsecond overhead, it powers the routing, validation, and JSON processing of the Quill PHP Framework.
Key Features
- Blazing Fast Routing: Uses a Radix-tree based router (
matchit) for O(1) performance in both PHP and CLI modes. - Native DTO Validation: Decouples validation from PHP userland, performing schema checks at native speeds before your code even runs.
- FFI-First Architecture: Seamlessly integrates into any PHP environment via the
FFIextension, with zero build-step requirements for the end user. - Cross-Platform: Automated release pipeline providing pre-built binaries for Linux and macOS (Intel & Apple Silicon).
- Efficient JSON Compaction: Specialized native methods for ultra-fast JSON transformations between boundaries.
Architecture Overview
The Quill Core acts as a high-performance intermediary between the incoming HTTP traffic and your PHP application logic:
graph LR
A[HTTP Request] --> B[Quill Core / Rust]
B -->|Native Match & Validate| C[PHP Kernel / FFI]
C -->|Handler Logic| D[PHP Application]
D -->|Response| C
C -->|Native Formatting| B
B --> E[HTTP Response]
Loading
Installation
Option 1: Using Pre-built Binaries (Recommended)
You can download the optimized shared libraries (.so or .dylib) and the required C-header (quill.h) directly from the GitHub Releases page.
Option 2: Building from Source
If you are contributing or need a custom build, you can compile from source using cargo:
# Clone the repository git clone https://github.com/quillphp/quill-core.git cd quill-core # Build the shared library (bin/ folder) ./scripts/build.sh --release
Integration with Quill PHP
By default, the Quill PHP framework will automatically discover the core library if it's placed in any of these locations:
build/libquill.so(Local Development)vendor/quillphp/quill-core/bin/libquill.so(Composer Integration)/usr/local/lib/libquill.so(Global System Level)
You can override the discovery behavior using the QUILL_CORE_BINARY environment variable:
export QUILL_CORE_BINARY=/path/to/your/libquill.so
Development & Testing
We maintain strict code quality standards to ensure consistency and performance.
# Run unit tests cargo test # Run Clippy (linter) cargo clippy -- -D warnings # Apply formatting cargo fmt --all
License
This project is open-sourced under the MIT License.