Skip to content

1.0.0: Merge pull request #19 from JUVOJustin/change-namespace

Choose a tag to compare

@JUVOJustin JUVOJustin released this 13 Feb 00:50
· 33 commits to main since this release
5a5ccd7

What's New

This release includes significant architectural improvements, new features, and comprehensive documentation updates.

🚀 Major Features

Meta Webhook Emission Modes

Added configurable emission modes for meta webhooks via Meta_Emission_Mode enum:

  • META: Only emit meta-entity webhook
  • BOTH (default): Emit meta webhook AND trigger parent entity update
  • ENTITY: Only trigger parent entity update (with automatic deduplication)
use Citation\WP_Webhook_Framework\Webhooks\Meta_Emission_Mode;
use Citation\WP_Webhook_Framework\Webhooks\Meta_Webhook;

$meta = new Meta_Webhook();
$meta->emission_mode(Meta_Emission_Mode::ENTITY);

Meta Webhook Deduplication

  • Automatic per-request deduplication for plugin hooks (ACF, Meta Box, etc.)
  • Prevents duplicate webhooks when plugins fire both their own hooks and WordPress meta filters
  • Special handling for repeater fields and slashed JSON values

Notification System

  • New extensible notification system using registry pattern
  • Built-in blocked email notification for webhook URL blocking
  • Support for custom notification handlers (Slack, PagerDuty, etc.)
// Enable notifications
$webhook->notifications(['blocked']);

📦 Repository Changes

📚 Documentation Overhaul

All documentation converted to MDX format with Astro Starlight frontmatter:

  • ✅ Frontmatter with title, description, and sidebar.order
  • ✅ Better navigation and organization
  • ✅ Reduced README overlap - content now lives in single source of truth
  • ✅ 6 comprehensive documentation files

New Documentation Structure:

Document Description
Configuration Webhook configuration methods, registry setup
Custom Webhooks Creating webhooks, plugin integrations
Hooks and Filters All actions and filters with examples
Failure Handling Retry mechanism, blocking, failure tracking
Notifications Notification system and custom handlers
Webhook Statefulness Statelessness rules and best practices

🔧 Core Improvements

Webhook State Management

  • Strict statelessness: Webhook instances are singletons and must remain stateless
  • Configuration set during init(), emission data passed to emit()
  • Prevents race conditions when multiple WordPress hooks fire rapidly

Failure Monitoring Enhancements

  • Automatic retry mechanism with exponential backoff (1min, 2min, 4min...)
  • Per-webhook max_retries() configuration
  • Consecutive failure tracking with configurable thresholds
  • URL auto-blocking after 10 failures (configurable)
  • Auto-unblock after 1 hour
  • Success resets failure count and blocked status

Code Quality

  • PHP 8.1+ with strict typing
  • PHPStan Level 6 static analysis
  • WordPress Coding Standards (WPCS 3.1)
  • Comprehensive inline documentation

🆕 New Classes

  • Meta_Emission_Mode - Enum for meta webhook emission modes
  • Webhook_Registry - Centralized webhook management
  • Notification (abstract) - Base class for notification handlers
  • Notification_Registry - Registry for notification handlers
  • Blocked - Built-in email notification handler
  • Entity_Handler - Base class for entity payload preparation

⚠️ Breaking Changes

  1. Package name changed: Update your composer.json:

    "require": {
        "juvo/wp-webhook-framework": "^1.0.0"
    }
  2. Emission modes: Meta webhooks now default to BOTH mode (meta + parent entity). To maintain previous behavior, explicitly set:

    $meta->emission_mode(Meta_Emission_Mode::META);
  3. No webhooks enabled by default: All webhooks are now opt-in only via wpwf_register_webhooks action.

🐛 Bug Fixes

  • Fixed duplicate webhook emission from ACF and other meta plugins
  • Corrected meta value comparison to handle slashed JSON properly
  • Improved equality checks for repeater fields

📝 Full Changelog

Commits since 0.1.0:

  • feat: Add Emission_Mode enum with strong typing
  • feat: Add configurable emission modes to Meta_Webhook
  • feat: Implement webhook retry mechanism with exponential backoff
  • feat: Add notification handling for webhook events
  • feat: Add filters for webhook configuration (max_consecutive_failures, timeout)
  • feat: Add webhook failure notification handling
  • feat: Add per-request deduplication for meta webhooks
  • docs: Convert all documentation to MDX with Astro Starlight frontmatter
  • docs: Add comprehensive webhook statefulness documentation
  • docs: Add failure handling and notifications documentation
  • refactor: Enforce registry pattern with strong PHPStan typing
  • refactor: Rename Emitter to Entity_Handler
  • refactor: Centralize dedup logic in on_meta_update
  • refactor: Convert class names to snake_case following WordPress conventions
  • fix: Handle repeater fields and slashed JSON in equality check
  • fix: Prevent duplicate webhooks from plugin meta hooks
  • chore: Remove enabled flag, make webhook registration fully opt-in
  • chore: Rename package from citation-media to juvo

📊 Stats

  • 87 commits since 0.1.0
  • 34 files changed
  • +2,523 lines added, -988 lines removed
  • 6 new documentation files
  • 5 new classes

Full diff: 0.1.0...1.0.0