Download the PHP package wpnx/handler without Composer
On this page you can find all versions of the php package wpnx/handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package handler
Short Description A flexible PHP request handler for WordPress installations
License MIT
Homepage https://wpnx.io
Informations about the package handler
WpNx Handler
A modern, secure PHP request handler for WordPress installations. Provides intelligent request routing, static file serving, and comprehensive security features. Optimized for traditional hosting, AWS Lambda, and containerized environments.
Features
- Simple API: Just three lines of code to get started
- Intelligent Routing: Automatic handling of WordPress requests, static files, and directories
- Security First: Built-in protection against common attacks
- Multisite Support: Full support for WordPress Multisite installations
- AWS Lambda Ready: Automatic environment detection and optimization
- Extensible: Easy to add custom processing logic
- Modern PHP: PHP 8.0+ with strict typing and Symfony HttpFoundation
Requirements
- PHP 8.0 or higher
- WordPress 5.0 or higher (recommended)
Installation
Install via Composer:
Quick Start
Minimal Setup
With Configuration
Configuration
Simple Configuration
Detailed Configuration
| Option | Type | Description | Default |
|---|---|---|---|
web_root |
string | Web root directory | Current directory |
wordpress_index |
string | WordPress index file | '/index.php' |
wp_directory |
string | WordPress directory | '/wp' |
index_files |
array | Index files to look for | ['index.php', 'index.html', 'index.htm'] |
| Multisite | |||
multisite |
bool/array | Enable multisite | false |
multisite.enabled |
bool | Enable multisite (detailed mode) | false |
multisite.pattern |
string | URL match pattern | '#^/[_0-9a-zA-Z-]+(/wp-.*)#' |
multisite.replacement |
string | URL replacement | '/wp$1' |
| Lambda | |||
lambda |
bool/array | Lambda mode | Auto-detect |
lambda.enabled |
bool | Force Lambda on/off | Auto-detect |
lambda.directories |
array | Directories to create | ['/tmp/uploads', '/tmp/cache', '/tmp/sessions'] |
| Security | |||
security.allow_directory_listing |
bool | Allow directory listing | false |
security.check_symlinks |
bool | Validate symlinks | true |
security.blocked_patterns |
array | Blocked URL patterns | See below |
Default blocked patterns:
/\.git//\.env//\.htaccess//composer\.(json|lock)//wp-config\.php//readme\.(txt|html|md)/i
WordPress Multisite
Simple Mode
Custom Pattern
AWS Lambda Support
Auto-Detection
The handler automatically detects Lambda environments and:
- Creates necessary temp directories
- Configures PHP settings for Lambda
- Optimizes for Lambda constraints
Manual Control
Extending the Handler
Custom Processors
Add custom request processing logic:
Built-in Processors
The handler uses a chain of processors in this order:
- SecurityProcessor - Validates requests and blocks attacks
- TrailingSlashProcessor - Ensures directories have trailing slashes
- StaticFileProcessor - Serves static files with proper MIME types
- PhpFileProcessor - Handles direct PHP file requests
- DirectoryProcessor - Looks for index files in directories
- MultisiteProcessor - Handles multisite URL rewriting
- WordPressProcessor - Falls back to WordPress index.php
Examples
Basic WordPress Site
Multisite Network
High-Security Setup
Lambda Deployment
Testing
Security
The handler includes comprehensive security measures:
- Path Traversal Protection: Prevents
../attacks - Symlink Validation: Ensures symlinks stay within web root
- Blocked Patterns: Protects sensitive files
- Null Byte Protection: Prevents null byte injection
- URL Encoding Protection: Detects encoded attacks
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.