How davidcole1340/ext-php-rs works
Main Components
a) Core Components:
• Rust Extension Core (src/)
• PHP Zend Engine Interface
• Macro System (crates/macros/)
• CLI Tools (crates/cli/)
• Type System Bridge
• Embedding System
b) Integration Layer:
• FFI (Foreign Function Interface)
• Zend API Bindings
• Type Conversion System
┌─────────────────────────────────────────────────────────┐
• PHP Application Layer │
• ┬─────────────────────────────────┘
• ↕
┌─────────────────────────────────────────────────────────┐
• Extension Interface │
• ┌───────────────┐ ┌──────────────┐ ┌──────────────┐ │
• PHP Functions │ │PHP Classes │ │Constants │ │
• ┘ └──────────────┘ └──────────────┘ │
• ┬─────────────────────────────────┘
• ↕
┌─────────────────────────────────────────────────────────┐
• Macro System Layer │
• ┌───────────────┐ ┌──────────────┐ ┌──────────────┐ │
• Function Macros│ │Class Macros │ │Module Macros │ │
• ┘ └──────────────┘ └──────────────┘ │
• ┬─────────────────────────────────┘
• ↕
┌─────────────────────────────────────────────────────────┐
• Type System Bridge │
• ┌───────────────┐ ┌──────────────┐ ┌──────────────┐ │
• Type Convert. │ │Zval Handling │ │Error Handling │ │
• ┘ └──────────────┘ └──────────────┘ │
• ┬─────────────────────────────────┘
• ↕
┌─────────────────────────────────────────────────────────┐
• FFI/Binding Layer │
• ┌───────────────┐ ┌──────────────┐ ┌──────────────┐ │
• Zend API │ │ PHP Embed │ │Native Bridge │ │
• ┘ └──────────────┘ └──────────────┘ │
• ┘
Key Elements to Highlight
a) Core Features:
• Type conversion system (src/convert.rs)
• Macro processing (crates/macros/)
• Zend API integration (src/zend/)
• Embedding support (src/embed/)
b) Extension Points:
• Custom type conversion implementation points
• Macro customization options
• Error handling pathways
Implementation Details
• The separation between PHP and Rust layers
• How macros transform Rust code into PHP-compatible extensions
• The type conversion system's role
• Error propagation paths
• How the FFI layer interfaces with PHP's internals
• How their Rust code is transformed into PHP extensions
• Where to implement custom functionality
• How different components interact
• The flow of data through the system
Remember to maintain a balance between detail and clarity, focusing on the architectural aspects that are most relevant to developers working with the system.