PHPackages                             arraypress/wp-register-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. arraypress/wp-register-plugin

ActiveLibrary

arraypress/wp-register-plugin
=============================

A universal WordPress plugin registration system with flexible requirements checking and conflict detection. Simplifies plugin development with smart defaults for EDD, WooCommerce, Elementor, and custom ecosystems.

176↓100%PHP

Since Dec 12Pushed 3mo agoCompare

[ Source](https://github.com/arraypress/wp-register-plugin)[ Packagist](https://packagist.org/packages/arraypress/wp-register-plugin)[ RSS](/packages/arraypress-wp-register-plugin/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

WordPress Plugin Registration - Simplified Plugin Development Made Easy
=======================================================================

[](#wordpress-plugin-registration---simplified-plugin-development-made-easy)

A universal WordPress plugin registration system that handles requirements checking, conflict detection, plugin links, and admin notices automatically. No more boilerplate code - just register your plugin with smart defaults and get back to building features.

Features
--------

[](#features)

- 🎯 **Dead Simple API**: One line to register most plugins
- 🔧 **Smart Defaults**: Pre-configured for EDD, WooCommerce, Elementor ecosystems
- ✅ **Requirements Checking**: Automatic PHP, WordPress, and plugin dependency validation
- ❌ **Conflict Detection**: Auto-deactivates conflicting plugins (like free vs pro versions)
- 🎨 **Professional Errors**: Beautiful WordPress-native error display in admin
- 🔗 **Plugin Links**: Automatic action and meta links in plugin list
- 📢 **Smart Notices**: Conditional admin notices with flexible display rules
- ⚡ **Zero Configuration**: Works out of the box with sensible defaults

Requirements
------------

[](#requirements)

- PHP 7.4 or later
- WordPress 6.8.1 or later

Installation
------------

[](#installation)

Install via Composer:

```
composer require arraypress/wp-register-plugin
```

Basic Usage
-----------

[](#basic-usage)

You can use either the Plugin class directly or the utility functions:

```
// Using utility functions (recommended)
register_plugin( __FILE__, function() {
    MyPlugin::init();
}, [
    'requirements' => [
        'php' => '7.4',
        'wp' => '6.0',
    ],
] );

// Using the Plugin class directly
use ArrayPress\RegisterPlugin\Plugin;

Plugin::register([
    'file' => __FILE__,
    'bootstrap' => function() {
        MyPlugin::init();
    },
    'requirements' => [
        'php' => '7.4',
        'wp' => '6.0',
    ],
]);
```

### Utility Functions

[](#utility-functions)

The package provides convenient utility functions for common scenarios:

```
// Basic plugin registration
register_plugin( __FILE__, function() {
    MyPlugin::init();
} );

// EDD extension with defaults
register_edd_plugin( __FILE__, function() {
    MyEDDExtension::init();
} );

// WooCommerce plugin with defaults
register_woocommerce_plugin( __FILE__, function() {
    MyWooPlugin::init();
} );

// Pro plugin that conflicts with free version
register_pro_plugin( __FILE__, function() {
    MyProPlugin::init();
}, 'my-plugin-free/plugin.php' );
```

Examples
--------

[](#examples)

### Basic Plugin with Links and Notices

[](#basic-plugin-with-links-and-notices)

```
register_plugin( __FILE__, function() {
    MyPlugin::init();
}, [
    'requirements' => [
        'php' => '7.4',
        'wp' => '6.0',
    ],
    'plugin_links' => [
        'settings' => admin_url( 'options-general.php?page=my-plugin' ),
        'docs' => [
            'url' => 'https://docs.my-plugin.com',
            'text' => 'Documentation',
            'target' => '_blank',
        ],
    ],
    'plugin_meta' => [
        'support' => 'https://support.my-plugin.com',
        'github' => 'https://github.com/me/my-plugin',
    ],
    'notices' => [
        'welcome' => [
            'type' => 'success',
            'message' => 'Welcome to My Plugin! Get started',
            'dismissible' => true,
            'show_once' => true,
        ],
    ],
] );
```

### EDD Extension

[](#edd-extension)

```
// Simple EDD extension - uses smart defaults
register_edd_plugin( __FILE__, function() {
    MyEDDExtension::init();
} );

// EDD extension with enhanced features
register_edd_plugin( __FILE__, function() {
    MyAdvancedEDDExtension::init();
}, [
    'requirements' => [
        'easy-digital-downloads' => '3.2.0', // Override default
        'php' => '8.0', // Higher PHP requirement
    ],
    'activation' => function() {
        MyAdvancedEDDExtension\Installer::create_tables();
    },
    'success' => function() {
        update_option( 'my_edd_extension_loaded', true );
    },
    'plugin_links' => [
        'settings' => [
            'url' => admin_url( 'edit.php?post_type=download&page=edd-settings&tab=extensions' ),
            'text' => 'Settings',
            'capability' => 'manage_shop_settings',
        ],
        'docs' => 'https://docs.my-edd-extension.com',
    ],
    'notices' => [
        'setup' => [
            'type' => 'warning',
            'message' => 'Please configure your EDD extension settings to get started.',
            'dismissible' => true,
            'show_until' => 'option_not_empty:my_edd_extension_configured',
            'pages' => [ 'download_page_edd-settings' ],
        ],
    ],
] );
```

### WooCommerce Plugin

[](#woocommerce-plugin)

```
// Simple WooCommerce plugin
register_woocommerce_plugin( __FILE__, function() {
    MyWooPlugin::init();
} );

// Advanced WooCommerce plugin with custom config
register_woocommerce_plugin( __FILE__, function() {
    MyProWooPlugin::init();
}, [
    'requirements' => [
        'php' => '8.1',
        'woocommerce' => '7.0.0',
        'memory_limit' => [
            'name' => 'PHP Memory Limit',
            'check' => function() {
                return ini_get('memory_limit');
            },
            'exists' => function() {
                $memory = wp_convert_hr_to_bytes( ini_get('memory_limit') );
                return $memory >= wp_convert_hr_to_bytes( '512M' );
            },
            'type' => 'callback',
        ],
    ],
    'activation' => function() {
        MyProWooPlugin\Installer::setup();
    },
    'plugin_links' => [
        'settings' => [
            'url' => admin_url( 'admin.php?page=wc-settings&tab=my-plugin' ),
            'text' => 'Settings',
            'capability' => 'manage_woocommerce',
        ],
        'premium' => [
            'url' => 'https://my-plugin.com/premium',
            'text' => 'Go Premium',
            'style' => 'color: #00a32a; font-weight: bold;',
            'target' => '_blank',
        ],
    ],
    'plugin_meta' => [
        'changelog' => 'https://my-plugin.com/changelog',
        'support' => [
            'url' => 'https://support.my-plugin.com',
            'text' => 'Premium Support',
            'capability' => 'manage_woocommerce',
        ],
    ],
    'notices' => [
        'api_setup' => [
            'type' => 'error',
            'message' => 'API configuration required. Please add your API keys in the settings.',
            'dismissible' => false,
            'show_until' => function() {
                return empty( get_option( 'my_woo_plugin_api_key' ) );
            },
            'pages' => [ 'woocommerce_page_wc-settings' ],
        ],
    ],
    'requirements_url' => 'https://docs.my-plugin.com/requirements',
    'support_url' => 'https://support.my-plugin.com',
] );
```

### Pro Plugin with Free Version Conflict

[](#pro-plugin-with-free-version-conflict)

```
// Pro plugin that auto-deactivates free version
register_pro_plugin( __FILE__, function() {
    MyProPlugin::init();
}, 'my-plugin-free/my-plugin-free.php' );

// Pro plugin with comprehensive setup
register_pro_plugin( __FILE__, function() {
    MyEDDPro::init();
}, 'my-edd-extension/my-edd-extension.php', [
    'requirements' => [
        'php' => '8.0',
        'easy-digital-downloads' => '3.2.0',
    ],
    'activation' => function() {
        MyEDDPro\License::activate();
        MyEDDPro\Installer::create_tables();
    },
    'success' => function() {
        update_option( 'my_edd_pro_active', true );
        do_action( 'my_edd_pro_loaded' );
    },
    'plugin_links' => [
        'license' => [
            'url' => admin_url( 'edit.php?post_type=download&page=edd-settings&tab=licenses' ),
            'text' => 'License',
            'capability' => 'manage_shop_settings',
        ],
        'support' => [
            'url' => 'https://premium-support.my-plugin.com',
            'text' => 'Premium Support',
            'target' => '_blank',
        ],
    ],
    'plugin_meta' => [
        'docs' => 'https://docs.my-plugin.com/pro',
        'changelog' => 'https://my-plugin.com/pro-changelog',
    ],
    'notices' => [
        'license_activation' => [
            'type' => 'warning',
            'message' => 'Please activate your license key to receive updates and support.',
            'dismissible' => true,
            'show_until' => function() {
                return ! MyEDDPro\License::is_active();
            },
            'capability' => 'manage_shop_settings',
        ],
        'free_version_deactivated' => [
            'type' => 'info',
            'message' => 'The free version has been automatically deactivated. All your settings have been preserved.',
            'dismissible' => true,
            'show_once' => true,
        ],
    ],
    'requirements_url' => 'https://docs.my-plugin.com/pro-requirements',
] );
```

### Complex Plugin with Advanced Features

[](#complex-plugin-with-advanced-features)

```
use ArrayPress\WP\Register\Plugin;

Plugin::register([
    'file' => __FILE__,
    'bootstrap' => function() {
        MyComplexPlugin::init();
    },
    'requirements' => [
        'php' => '8.1',
        'wp' => '6.3',
        'woocommerce' => '7.0.0',
        'curl_extension' => [
            'name' => 'PHP cURL Extension',
            'exists' => function() {
                return extension_loaded( 'curl' );
            },
        ],
        'memory_limit' => [
            'name' => 'PHP Memory Limit',
            'check' => function() {
                return ini_get('memory_limit');
            },
            'exists' => function() {
                $memory = wp_convert_hr_to_bytes( ini_get('memory_limit') );
                return $memory >= wp_convert_hr_to_bytes( '256M' );
            },
            'type' => 'callback',
        ],
    ],
    'conflicts' => [
        'competitor' => [
            'name' => 'Competitor Plugin',
            'check' => 'COMPETITOR_VERSION',
            'type' => 'constant',
            'action' => 'block',
            'message' => 'Conflict: Please deactivate Competitor Plugin first.',
        ],
        'old_version' => [
            'name' => 'Outdated Version',
            'check' => 'MY_PLUGIN_OLD_VERSION',
            'type' => 'constant',
            'condition' => function( $result ) {
                return $result['exists'] && version_compare( $result['version'], '2.0.0', 'Configure settings',
            'dismissible' => true,
            'show_once' => true,
            'capability' => 'manage_options',
            'pages' => [ 'plugins', 'dashboard' ],
        ],
        'setup_required' => [
            'type' => 'warning',
            'message' => 'Setup required to unlock all features. Complete setup',
            'dismissible' => true,
            'show_until' => 'option_not_empty:my_complex_plugin_setup_complete',
            'capability' => 'manage_options',
        ],
        'api_key_missing' => [
            'type' => 'error',
            'message' => 'API Key Required: Please enter your API key to enable all features.',
            'dismissible' => false,
            'show_until' => function() {
                return empty( get_option( 'my_complex_plugin_api_key' ) );
            },
            'pages' => [ 'my-complex-plugin' ],
        ],
        'update_available' => [
            'type' => 'info',
            'message' => '🔄 Update available with new features and improvements. Update now',
            'dismissible' => true,
            'show_until' => function() {
                return version_compare( get_file_data( __FILE__, [ 'Version' ] )[0], '2.0.0', 'Configure settings',
            'dismissible' => true,
            'show_once' => true,
        ],
    ],
] );
```

### WooCommerce Extension Template

[](#woocommerce-extension-template)

```
register_woocommerce_plugin( __FILE__, function() {
    YourWooPlugin::init();
}, [
    'plugin_links' => [
        'settings' => admin_url( 'admin.php?page=wc-settings&tab=your-plugin' ),
    ],
    'notices' => [
        'welcome' => [
            'type' => 'success',
            'message' => 'WooCommerce Extension activated! Configure settings',
            'dismissible' => true,
            'show_once' => true,
        ],
    ],
] );
```

### Pro Plugin Template

[](#pro-plugin-template)

```
register_pro_plugin( __FILE__, function() {
    YourProPlugin::init();
}, 'your-free-plugin/plugin.php', [
    'plugin_links' => [
        'license' => admin_url( 'options-general.php?page=your-plugin-license' ),
        'support' => 'https://premium-support.your-plugin.com',
    ],
    'notices' => [
        'license' => [
            'type' => 'warning',
            'message' => 'Please activate your license key to receive updates.',
            'dismissible' => true,
            'show_until' => function() {
                return ! YourProPlugin\License::is_active();
            },
        ],
    ],
] );
```

### Basic Plugin Template

[](#basic-plugin-template)

```
register_plugin( __FILE__, function() {
    YourPlugin::init();
}, [
    'requirements' => [
        'php' => '7.4',
        'wp' => '6.0',
    ],
    'plugin_links' => [
        'settings' => admin_url( 'options-general.php?page=your-plugin' ),
    ],
    'notices' => [
        'welcome' => [
            'type' => 'success',
            'message' => 'Plugin activated successfully!',
            'dismissible' => true,
            'show_once' => true,
        ],
    ],
] );
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License
-------

[](#license)

Licensed under the GPLv2 or later license.

Support
-------

[](#support)

- [Issue Tracker](https://github.com/arraypress/wp-register-plugin/issues)

###  Health Score

21

—

LowBetter than 21% of packages

Maintenance54

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cd6eb8aff0903d87eb674d1ba3c5f3653899c0d7661504eb0deb7798ed86b643?d=identicon)[arraypress](/maintainers/arraypress)

---

Top Contributors

[![arraypress](https://avatars.githubusercontent.com/u/22668877?v=4)](https://github.com/arraypress "arraypress (10 commits)")

### Embed Badge

![Health badge](/badges/arraypress-wp-register-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/arraypress-wp-register-plugin/health.svg)](https://phpackages.com/packages/arraypress-wp-register-plugin)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
