Skip to content

Commit aa4d85c

Browse files
authored
[Docs] Documentation Expansion for php-wasm/node (#2780)
## Summary Transforms the minimal `php-wasm/node` documentation into a comprehensive developer guide with practical examples, integration patterns, and real-world use cases. ## Motivation The existing documentation provided only a basic usage example and API reference link, leaving developers without: - Clear understanding of when and why to use `@php-wasm/node` - Practical, copy-paste ready code examples - Guidance on integrating with existing Node.js tooling - Best practices for performance and error handling This created friction for developers trying to adopt WordPress Playground in Node.js environments. ## Changes ### 📚 Documentation Structure - Added front matter (title, slug) for documentation site integration - Organized content into logical sections with clear hierarchy - Included 15+ working code examples across multiple scenarios ### 🎯 New Sections #### Use Cases (8 categories) Defines clear scenarios where `@php-wasm/node` provides value: - Server-Side PHP Execution (CI/CD, testing, microservices) - Data Processing & Transformation (CSV, JSON, SQLite, ZIP) - Template Rendering & Content Generation - API Development & Testing - PHP Code Analysis & Testing - Legacy Code Integration - Educational Platforms - WordPress Development Tools #### Practical Demos (6 complete examples) Working code demonstrations of common patterns: 1. **File System Operations** - Directory creation, file I/O, JSON handling 2. **SQLite Database Operations** - Schema creation, CRUD operations, queries 3. **Processing ZIP Archives** - Archive creation, inspection, extraction 4. **HTTP Request/Response Pattern** - Simulating web server behavior 5. **Template Rendering Engine** - Dynamic HTML generation from templates 6. **Real-time Code Execution & Streaming** - Streaming output handling ### 🔧 Technical Details - All examples use ES modules syntax - TypeScript examples included for type-safe implementations - Code follows consistent formatting and style - Examples are self-contained and immediately runnable ## Impact **For Developers:** - Provides ready-to-use patterns for common scenarios - Demonstrates integration with popular Node.js tools
1 parent 39dca34 commit aa4d85c

File tree

4 files changed

+2532
-15
lines changed

4 files changed

+2532
-15
lines changed

0 commit comments

Comments
 (0)