Skip to content

gotowebpl/shadow-orm

Repository files navigation

ShadowORM MySQL Accelerator

PHP Version WordPress License

High-performance ORM layer for WordPress/WooCommerce with Shadow Tables

ShadowORM dramatically accelerates meta queries by storing post metadata in optimized "shadow tables" with native JSON support (MySQL 8.0+) or lookup tables (MySQL 5.7/MariaDB).

Features

  • Dual-Driver Strategy - Automatic detection of MySQL version
    • MySQL 8.0+: Native JSON columns with Multi-Valued Indexes
    • MySQL 5.7/MariaDB: Lookup tables with standard JOINs
  • Zero Configuration - Works out of the box after activation
  • WP-CLI Support - Full command-line interface for migrations
  • Admin Panel - Visual management of shadow tables
  • Transparent Integration - Intercepts get_post_meta() automatically
  • RAM Cache - In-memory caching for repeat reads

Requirements

  • PHP 8.1+
  • WordPress 6.0+
  • MySQL 5.7+ or MariaDB 10.2+

Installation

Via Composer

cd wp-content/plugins
git clone https://github.com/gotoweb/shadow-orm.git
cd shadow-orm
composer install

Manual

  1. Download the latest release from Releases
  2. Upload to wp-content/plugins/shadow-orm/
  3. Run composer install
  4. Activate in WordPress Admin

Quick Start

# Check status
wp shadow status

# Migrate posts
wp shadow migrate --type=post

# Migrate all supported types
wp shadow migrate --all

# Benchmark performance
wp shadow benchmark --type=product --iterations=10

Admin Panel

Navigate to Settings → ShadowORM to:

  • Enable/disable the system
  • Toggle shadow tables per post type
  • View migration status
  • Sync or rollback tables

Free vs Pro

Feature Free Pro
Database Optimization
MySQL 8.0 Native JSON
MySQL 5.7 Lookup Tables
WP-CLI Commands
Admin Panel
RAM Cache
Caching System
Object Cache (Redis/Memcached)
Page Cache (Full HTML)
Query Cache (WP_Query results)
Tag-based auto-invalidation
Symfony Filesystem fallback
WooCommerce
Simple Products
Product Variations
Stock/Price cache exclusion
WooCommerce Optimizer
Integrations
ACF Repeater/Flexible
WPML/Polylang Support
Admin Features
Virtual Mode
Advanced Dashboard
Transients Management
Autoload Optimization
Priority Support

Get ShadowORM Pro →

WP-CLI Commands

Command Description
wp shadow status Show migration status for all types
wp shadow migrate --type=<type> Migrate specific post type
wp shadow migrate --all Migrate all configured types
wp shadow migrate --dry-run Preview without changes
wp shadow rollback --type=<type> Remove shadow table
wp shadow benchmark --type=<type> Performance benchmark

How It Works

  1. Activation: Plugin installs db.php drop-in and MU-plugin loader
  2. Migration: wp shadow migrate copies meta to shadow tables
  3. Read Interception: get_post_meta() reads from shadow tables first
  4. Write Sync: save_post hook keeps shadow tables updated
  5. Query Optimization: meta_query uses JSON functions or lookup JOINs

Performance

Scenario Without ShadowORM With ShadowORM
Single meta read ~2ms <0.5ms
50 products with filters ~200ms ~50ms
Category page TTFB ~400ms ~150ms

Results on VPS with 2 vCPU, 4GB RAM, MySQL 8.0

Development

# Run tests
./vendor/bin/phpunit --testsuite=unit

# Static analysis
./vendor/bin/phpstan analyse

# Code style
./vendor/bin/phpcs src/

Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open Pull Request

Support

Author

gotoweb.pl - WordPress & WooCommerce Experts

License

This project is licensed under the GPL-2.0-or-later License - see the LICENSE file for details.


Made with ❤️ by gotoweb.pl

About

High-performance ORM layer for WordPress/WooCommerce with Shadow Tables

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors