How xenira/ext-php-rs works
Main Components
a) Core Framework Components:
• Rust Extension API Layer
• Zend API Bridge
• Type System Converter
• Macro System
• Embedding System
b) Build System:
• Cargo Build Pipeline
• PHP Extension Compiler
• Stub Generator
Component Relationships and Architecture
[PHP Application Layer]
• ↕
[PHP Extension Interface]
• ↕
[ext-php-rs Framework]
• Macros Types Builders
[Rust-Zend Bridge Layer]
• ↕
[Zend Engine API]
Key Elements to Highlight
a) Framework Core (src/):
• Type System (/src/types/)
• Builder System (/src/builders/)
• Embedding System (/src/embed/)
• Zend API Interface (/src/zend/)
b) Macro System (crates/macros/):
• Function Macros
• Class Macros
• Module Macros
• Implementation Macros
c) CLI Tools (crates/cli/):
• Stub Generation
• Installation Tools
• Build Management
Data Flow Indicators
• Bidirectional communication between PHP and Rust layers
• Type conversion flows
• Macro expansion paths
• Build pipeline flow
Implementation Details
• FFI boundary between Rust and PHP
• Macro processing pipeline
• Type conversion system
• Extension loading mechanism
• Safety boundaries
• Type conversion mechanisms
• Memory management
• Error handling paths
Remember to indicate the optional features (closure support, anyhow error handling) as modular components that can be enabled or disabled.
This system design should help developers understand both how to use the framework and how it works internally, while maintaining a clear separation of concerns between the various components.