Skip to content

Developer Documentation

> InfoWebPlus: https://infowebplus.com

Namespace

All classes use the RedirectContentManager\ PSR-4 namespace, autoloaded from the classes/ directory.

Dependency Injection

Access the container via:

$container = rcm()->container();
$scan_service = $container->get( \RedirectContentManager\Services\ScanService::class );

Adding a Redirect Provider

Implement RedirectProviderInterface:

use RedirectContentManager\Interfaces\RedirectProviderInterface;
use RedirectContentManager\Models\RedirectResult;

class MyRedirectProvider implements RedirectProviderInterface {
    public function get_slug(): string { return 'my-provider'; }
    public function get_name(): string { return 'My Provider'; }
    public function is_available(): bool { return true; }
    public function detect( string $url ): RedirectResult { /* ... */ }
    public function get_all_redirects(): array { /* ... */ }
}

Register via filter:

add_filter( 'rcm_redirect_providers', function ( array $providers ) {
    $providers['my-provider'] = new MyRedirectProvider();
    return $providers;
} );

Adding an SEO Adapter

Implement SeoAdapterInterface and register with rcm_seo_adapters filter.

Adding a Health Check

add_filter( 'rcm_health_checks', function ( array $checks ) {
    $checks['my_check'] = function () {
        return array( /* HealthIssue objects */ );
    };
    return $checks;
} );

Adding a Future Module

add_filter( 'rcm_modules', function ( array $modules ) {
    $modules['gsc'] = new MyGscModule();
    return $modules;
} );

Modules should implement a boot() method.

Database Tables

| Table | Purpose |

|-------|---------|

| {prefix}rcm_monitored_items | Monitored URLs and scan data |

| {prefix}rcm_scan_logs | Scan history |

| {prefix}rcm_health_issues | SEO health issues |

| {prefix}rcm_activity_logs | Activity audit trail |

REST API Authentication

All endpoints require the manage_options capability. Use WordPress REST nonce:

fetch('/wp-json/redirect-content-manager/v1/statistics', {
    headers: { 'X-WP-Nonce': wpApiSettings.nonce }
});

Coding Standards

  • WordPress Coding Standards (WPCS)
  • PHPStan level 8
  • Strict types in all files
  • Prepared SQL statements only
  • Nonce verification on all admin actions

Running Tests

composer test              # Unit + integration
composer test:unit         # Unit tests only (no WordPress DB)
composer test:integration  # Integration tests only
composer phpcs
composer phpstan

WordPress Test Suite (Integration Tests)

Integration tests live in tests/Integration/ and require the official WordPress test suite.

Without the harness, they automatically call markTestSkipped().

Local setup

Adjust database credentials as needed:

export WP_TESTS_DIR=/tmp/wordpress-tests-lib
export WP_CORE_DIR=/tmp/wordpress/

git clone --depth=1 --branch trunk https://github.com/WordPress/wordpress-develop.git /tmp/wordpress-develop
bash /tmp/wordpress-develop/bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 latest

composer test:integration

Continuous Integration

GitHub Actions (.github/workflows/ci.yml) provisions MySQL 8, installs the WordPress test suite from wordpress-develop, and runs the full PHPUnit suite (unit + integration) on PHP 8.2 and 8.3.