PHPackages                             wpboilerplate/wordpress-plugin-boilerplate - 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. wpboilerplate/wordpress-plugin-boilerplate

ActiveWordpress-plugin

wpboilerplate/wordpress-plugin-boilerplate
==========================================

Composer to autoload the condition checking for which this add-on is made

v1.0.1(3y ago)11[4 issues](https://github.com/WPBoilerplate/wordpress-plugin-boilerplate/issues)GPL-2.0-or-laterPHPCI failing

Since Apr 27Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/WPBoilerplate/wordpress-plugin-boilerplate)[ Packagist](https://packagist.org/packages/wpboilerplate/wordpress-plugin-boilerplate)[ Docs](https://acrosswp.com/)[ RSS](/packages/wpboilerplate-wordpress-plugin-boilerplate/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (0)

WordPress Plugin Boilerplate
============================

[](#wordpress-plugin-boilerplate)

A comprehensive, modern WordPress plugin boilerplate that follows WordPress coding standards and incorporates the latest development tools and best practices.

[![WordPress](https://camo.githubusercontent.com/0d229e0c91cb9bd358205a922caca6f9ee9ccd78fddf16c99a2baf5ed4a0c8f3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f576f726450726573732d342e392e312532422d626c75652e737667)](https://wordpress.org)[![PHP](https://camo.githubusercontent.com/46a695f7a54c084f557b0c4d071535f93bc900c7f3c5555b72cee70a1ecd670c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342532422d707572706c652e737667)](https://php.net)[![License](https://camo.githubusercontent.com/d2da33c571d44486175c5a2f2a6a76560dd386a891efc5c908ef6c5f26356076/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c25323076322532422d7265642e737667)](http://www.gnu.org/licenses/gpl-2.0.html)

🚀 Features
----------

[](#-features)

- \*\*Modern PHP Development\*├── 📁 vendor/ # Composer dependencies ├── 📄 composer.json # Composer configuration (includes Mozart) ├── 📄 package.json # npm configuration ├── 📄 webpack.config.js # Build configuration ├── 📄 init-plugin.sh # Initialization script └── 📄 your-plugin.php # Main plugin file-4 autoloading, namespace organization
- **WordPress Standards**: Follows WordPress Coding Standards (WPCS)
- **Build System**: @wordpress/scripts with Webpack, Babel, and SCSS support
- **Block Development**: Integrated Gutenberg block creation and registration
- **Automated Deployment**: GitHub Actions for WordPress.org deployment
- **Internationalization**: Built-in i18n support with POT file generation
- **Composer Integration**: Dependency management with custom WPBoilerplate packages
- **Security**: Built-in security best practices and sanitization

📋 Requirements
--------------

[](#-requirements)

- **WordPress**: 4.9.1 or higher
- **PHP**: 7.4 or higher (8.0+ recommended)
    - ⚠️ **Critical**: PHP 7.4 is the **minimum required version** enforced by `composer.json`
    - 🚀 **Recommended**: PHP 8.0+ for better performance and modern language features
    - 🔒 **Enforcement**: Composer will prevent installation on older PHP versions
- **Node.js**: 14.0 or higher
- **Composer**: 2.0 or higher

### 🔍 PHP Version Verification

[](#-php-version-verification)

Before installation, verify your PHP version meets the requirements:

```
# Check PHP version
php -v

# Should show PHP 7.4.0 or higher
# Example: PHP 8.0.30 (cli) (built: Aug  5 2023 10:50:05)
```

**Why PHP 7.4+?**

- ✅ **Modern Features**: Arrow functions, typed properties, null coalescing assignment
- ✅ **Performance**: Significant performance improvements over PHP 7.3 and earlier
- ✅ **Security**: Better security features and ongoing support
- ✅ **WordPress Compatibility**: Full compatibility with modern WordPress features
- ✅ **Ecosystem**: Required by modern WordPress development tools and packages

🛠️ Quick Start
--------------

[](#️-quick-start)

### Method 1: Using the Initialization Script (Recommended)

[](#method-1-using-the-initialization-script-recommended)

1. **Clone the boilerplate**:

    ```
    git clone https://github.com/WPBoilerplate/wordpress-plugin-boilerplate.git
    cd wordpress-plugin-boilerplate
    ```
2. **Run the initialization script**:

    ```
    ./init-plugin.sh
    ```
3. **Follow the interactive prompts**:

    - Enter your plugin name (e.g., "My Awesome Plugin")
    - Enter your GitHub organization name (e.g., "MyCompany")
    - **Optional**: Select WPBoilerplate packages for WordPress integrations:
        - `wpb-register-blocks` - Auto-register Gutenberg blocks
        - `wpb-updater-checker-github` - GitHub-based auto-updates
        - `wpb-buddypress-or-buddyboss-dependency` - BuddyPress/BuddyBoss compatibility
        - `wpb-woocommerce-dependency` - WooCommerce integration support
        - And more specialized packages for common WordPress needs
    - The script will automatically:
        - Create a new plugin with your details
        - Install selected packages via Composer
        - Add integration code to `includes/main.php`
        - Set up the complete development environment

### Method 2: Manual Setup

[](#method-2-manual-setup)

1. **Clone and rename**:

    ```
    git clone https://github.com/WPBoilerplate/wordpress-plugin-boilerplate.git my-plugin-name
    cd my-plugin-name
    ```
2. **Install dependencies**:

    ```
    composer install
    npm install
    ```
3. **Build assets**:

    ```
    npm run build
    ```

🏗️ Build System (@wordpress/scripts)
------------------------------------

[](#️-build-system-wordpressscripts)

The plugin uses WordPress's official build tools for modern development workflows:

### Available Commands

[](#available-commands)

```
# Development build with hot reloading
npm run start

# Production build (optimized & minified)
npm run build

# Lint JavaScript files
npm run lint:js

# Fix JavaScript formatting issues
npm run lint:js:fix

# Lint CSS/SCSS files
npm run lint:css

# Generate translation files
npm run makepot

# Development dependencies check
npm run packages-update
```

### Asset Pipeline

[](#asset-pipeline)

- **SCSS → CSS**: Automatic compilation with autoprefixing and minification
- **Modern JavaScript**: Babel transpilation for browser compatibility
- **Hot Reload**: Live reloading during development with `npm run start`
- **Source Maps**: Available in development mode for debugging
- **Asset Optimization**: Image compression and optimization

📦 WPBoilerplate Ecosystem
-------------------------

[](#-wpboilerplate-ecosystem)

The boilerplate integrates with a comprehensive ecosystem of WordPress-specific Composer packages to accelerate development:

### Core Integration Packages

[](#core-integration-packages)

PackagePurposeAuto-Integration`wpboilerplate/wpb-register-blocks`Auto-register Gutenberg blocks from `build/blocks/`✅`wpboilerplate/wpb-updater-checker-github`GitHub-based plugin auto-updates✅`coenjacobs/mozart`PHP dependency scoping and prefixing to prevent conflictsManual### Dependency Management Packages

[](#dependency-management-packages)

PackagePurposeAuto-Integration`wpboilerplate/wpb-buddypress-or-buddyboss-dependency`BuddyPress/BuddyBoss compatibility checker✅`wpboilerplate/wpb-buddyboss-dependency`BuddyBoss Platform dependency✅`wpboilerplate/wpb-woocommerce-dependency`WooCommerce integration support✅`wpboilerplate/acrossswp-acf-pro-dependency`Advanced Custom Fields Pro dependency✅### Analytics &amp; Tracking

[](#analytics--tracking)

PackagePurposeAuto-Integration`wpboilerplate/wpb-view-analytics-dependency`View analytics and tracking✅### Installation via Script

[](#installation-via-script)

When using `./init-plugin.sh`, you can interactively select packages during setup. The script will:

- Add packages to `composer.json`
- Install via `composer install`
- **Automatically generate integration code** in `includes/main.php`
- Configure proper class instantiation and dependency checks

### Manual Installation

[](#manual-installation)

You can also add packages manually after setup:

```
# Install a specific package
composer require wpboilerplate/wpb-register-blocks

# Add integration code to includes/main.php
# (See the package documentation for specific integration patterns)
```

🧱 Block Development
-------------------

[](#-block-development)

The boilerplate includes seamless integration for creating and managing Gutenberg blocks.

### Creating Blocks

[](#creating-blocks)

1. **Create a block folder inside the `src/blocks` directory and scaffold a block**:

    ```
    mkdir -p src/blocks
    cd src/blocks
    npx @wordpress/create-block my-plugin-name-block --no-plugin
    ```

    This will scaffold a new block inside `src/blocks/my-plugin-name-block`.
2. **Add the block registration package**:

    ```
    composer require wpboilerplate/wpb-register-blocks
    ```
3. **Integration is automatic** - The block registration is already configured in `includes/main.php`:

```
/**
 * Auto-register blocks from build/blocks directory
 */
if ( class_exists( 'WPBoilerplate\\RegisterBlocks\\RegisterBlocks' ) ) {
    new \\WPBoilerplate\RegisterBlocks\RegisterBlocks( $this->plugin_dir );
}
```

4. **Install dependencies and build**: ```
    composer update
    npm run build
    ```

### How Block Registration Works

[](#how-block-registration-works)

The `wpb-register-blocks` package automatically:

- 🔍 Scans your plugin's `build/blocks/` directory
- 📝 Registers all block types found in subdirectories
- ⚡ Hooks into WordPress `init` action to register blocks
- 🎯 Uses PSR-4 autoloading for optimal performance

### Block Structure

[](#block-structure)

```
build/blocks/
├── my-block/
│   ├── block.json          # Block configuration
│   ├── index.js           # Block JavaScript
│   ├── style.css         # Block styles
│   └── editor.css        # Editor-only styles
└── another-block/
    └── ...

```

🎯 Advanced Block Development: Multiple Input Files
--------------------------------------------------

[](#-advanced-block-development-multiple-input-files)

### Using x3p0-ideas Block Example

[](#using-x3p0-ideas-block-example)

We now use the comprehensive [x3p0-ideas block example](https://github.com/x3p0-dev/x3p0-ideas/tree/block-example) as our reference for advanced block development patterns. This example demonstrates best practices for:

#### **Multiple Input File Architecture**

[](#multiple-input-file-architecture)

```
src/blocks/
├── example-block/
│   ├── block.json          # Block metadata and configuration
│   ├── index.js           # Main block registration
│   ├── edit.js            # Editor component (separate file)
│   ├── save.js            # Save component (separate file)
│   ├── view.js            # Frontend interactivity (separate file)
│   ├── style.scss         # Frontend styles
│   ├── editor.scss        # Editor-specific styles
│   └── variations.js      # Block variations (separate file)

```

#### **Key Benefits of Multiple Input Files:**

[](#key-benefits-of-multiple-input-files)

1. **🔧 Modular Architecture**:

    - Separate concerns for edit, save, and view functionality
    - Easier maintenance and code organization
    - Better team collaboration with clear file responsibilities
2. **⚡ Optimized Loading**:

    - Frontend scripts only loaded when needed
    - Smaller bundle sizes through code splitting
    - Better performance with conditional loading
3. **🎨 Advanced Styling**:

    - Separate SCSS files for editor and frontend
    - CSS custom properties for dynamic styling
    - Theme integration capabilities
4. **🛠️ Enhanced Functionality**:

    - Block variations in dedicated files
    - Custom block controls and settings
    - Advanced interactivity patterns

#### **Implementation with @wordpress/scripts**

[](#implementation-with-wordpressscripts)

The build system automatically handles multiple input files:

```
// webpack.config.js automatically processes:
const entries = {
    // Main block files
    'blocks/example-block/index': './src/blocks/example-block/index.js',
    'blocks/example-block/view': './src/blocks/example-block/view.js',

    // Style files
    'blocks/example-block/style': './src/blocks/example-block/style.scss',
    'blocks/example-block/editor': './src/blocks/example-block/editor.scss',
};
```

#### **x3p0-ideas Integration Patterns**

[](#x3p0-ideas-integration-patterns)

Based on the [x3p0-ideas block example](https://github.com/x3p0-dev/x3p0-ideas/tree/block-example), implement these patterns:

1. **Block Registration with Multiple Assets**:

    ```
    {
      "name": "my-plugin/example-block",
      "editorScript": "file:./index.js",
      "viewScript": "file:./view.js",
      "style": "file:./style.css",
      "editorStyle": "file:./editor.css"
    }
    ```
2. **Modular Component Structure**:

    ```
    // index.js - Main registration
    import { registerBlockType } from '@wordpress/blocks';
    import Edit from './edit';
    import Save from './save';
    import metadata from './block.json';

    registerBlockType( metadata.name, {
        ...metadata,
        edit: Edit,
        save: Save,
    } );
    ```
3. **Separate Edit Component**:

    ```
    // edit.js - Editor interface
    import { useBlockProps } from '@wordpress/block-editor';
    import { PanelBody, TextControl } from '@wordpress/components';

    export default function Edit( { attributes, setAttributes } ) {
        // Complex editor logic here
    }
    ```
4. **Frontend Interactivity**:

    ```
    // view.js - Frontend behavior
    import domReady from '@wordpress/dom-ready';

    domReady( () => {
        // Frontend JavaScript for block interactions
    } );
    ```

#### **Setup Instructions for x3p0-ideas Pattern**

[](#setup-instructions-for-x3p0-ideas-pattern)

1. **Clone the example structure**:

    ```
    # Reference the x3p0-ideas block structure
    mkdir -p src/blocks/your-block
    # Copy patterns from https://github.com/x3p0-dev/x3p0-ideas/tree/block-example
    ```
2. **Configure multiple entry points**:

    ```
    # The build system automatically detects:
    npm run build
    # Creates: build/blocks/your-block/{index.js, view.js, style.css, editor.css}
    ```
3. **Automatic registration**:

    ```
    // wpb-register-blocks automatically handles multiple assets
    // No additional configuration needed!
    ```

### **Advanced Features from x3p0-ideas**

[](#advanced-features-from-x3p0-ideas)

- **🎛️ Dynamic Block Variations**: Runtime block variations based on content
- **🎨 CSS Custom Properties**: Dynamic styling with CSS variables
- **⚡ Conditional Asset Loading**: Scripts/styles loaded only when blocks are present
- **🔧 Custom Inspector Controls**: Advanced sidebar panels and settings
- **📱 Responsive Design Patterns**: Mobile-first block development
- **♿ Accessibility Best Practices**: WCAG compliant block interfaces

📦 Composer Packages
-------------------

[](#-composer-packages)

### 🔒 PHP Version Requirement

[](#-php-version-requirement)

**IMPORTANT**: All WPBoilerplate packages require **PHP 7.4+**. This is enforced in `composer.json`:

```
{
    "require": {
        "php": ">=7.4"
    }
}
```

**Installation Protection**:

- ❌ Composer will **refuse to install** on PHP &lt; 7.4
- ✅ Ensures compatibility across all environments
- 🛡️ Prevents runtime errors from version incompatibilities

### WPBoilerplate Package Ecosystem

[](#wpboilerplate-package-ecosystem)

The boilerplate integrates with a comprehensive ecosystem of WordPress-specific Composer packages:

#### Core Packages

[](#core-packages)

```
# Block registration and management
composer require wpboilerplate/wpb-register-blocks

# GitHub-based plugin updates
composer require wpboilerplate/wpb-updater-checker-github
```

#### Dependency Management &amp; Build Tools

[](#dependency-management--build-tools)

```
# Mozart - PHP dependency scoping and namespacing (already included)
# composer require coenjacobs/mozart:^0.7  # Already included in base composer.json
```

**Mozart Integration**: Mozart helps prevent plugin conflicts by automatically scoping and prefixing third-party PHP dependencies. This is essential when multiple plugins use the same dependencies.

✅ **Pre-installed**: Mozart is already included in the base `composer.json` as a core development tool.

**Configuration Example**:

```
{
  "extra": {
    "mozart": {
      "dep_namespace": "WordPress_Plugin_Boilerplate\\Vendor\\",
      "dep_directory": "/src/dependencies/",
      "packages": [
        "vendor/package-name"
      ]
    }
  }
}
```

**Usage**:

- Mozart is already installed - just add configuration to `composer.json`
- Configure which packages to scope in the `mozart.packages` array
- Run `vendor/bin/mozart compose` to scope dependencies
- All specified packages will be prefixed to avoid conflicts

#### Plugin Dependencies

[](#plugin-dependencies)

```
# BuddyPress/BuddyBoss Platform integration
composer require wpboilerplate/wpb-buddypress-or-buddyboss-dependency

# BuddyBoss Platform specific
composer require wpboilerplate/wpb-buddyboss-dependency

# WooCommerce integration
composer require wpboilerplate/wpb-woocommerce-dependency

# Advanced Custom Fields Pro
composer require wpboilerplate/acrossswp-acf-pro-dependency

# Analytics and tracking
composer require wpboilerplate/wpb-view-analytics-dependency
```

### Package Integration Examples

[](#package-integration-examples)

#### GitHub Auto-Updates

[](#github-auto-updates)

```
// Add to load_composer_dependencies() method
if ( class_exists( 'WPBoilerplate_Updater_Checker_Github' ) ) {
    $package = array(
        'repo'              => 'https://github.com/YourOrg/your-plugin',
        'file_path'         => YOUR_PLUGIN_FILE,
        'plugin_name_slug'  => 'your-plugin-slug',
        'release_branch'    => 'main'
    );
    new WPBoilerplate_Updater_Checker_Github( $package );
}
```

#### Plugin Dependencies

[](#plugin-dependencies-1)

```
// BuddyPress/BuddyBoss dependency check
if ( class_exists( 'WPBoilerplate_BuddyPress_BuddyBoss_Platform_Dependency' ) ) {
    new WPBoilerplate_BuddyPress_BuddyBoss_Platform_Dependency(
        $this->get_plugin_name(),
        YOUR_PLUGIN_FILES
    );
}
```

🏗️ Project Structure
--------------------

[](#️-project-structure)

```
wordpress-plugin-boilerplate/
├── 📁 .github/                    # GitHub Actions & templates
│   ├── workflows/
│   │   ├── build-zip.yml         # Automated ZIP creation
│   │   └── wordpress-plugin-deploy.yml  # WP.org deployment
│   └── copilot-instructions.md   # AI development guidelines
├── 📁 .wordpress-org/            # WordPress.org assets
│   ├── banner-1544x500.jpg      # Large banner
│   ├── banner-772x250.jpg       # Small banner
│   ├── icon-128x128.jpg         # Small icon
│   └── icon-256x256.jpg         # Large icon
├── 📁 admin/                     # Admin functionality
│   ├── Main.php                 # Admin main class
│   └── partials/               # Admin templates
├── 📁 build/                     # Compiled assets (auto-generated)
│   ├── css/                    # Compiled stylesheets
│   ├── js/                     # Compiled JavaScript
│   └── media/                  # Processed images
├── 📁 includes/                  # Core classes
│   ├── main.php               # Main plugin class
│   ├── loader.php             # Hook management
│   ├── activator.php          # Activation logic
│   ├── deactivator.php        # Deactivation logic
│   ├── i18n.php               # Internationalization
│   └── Autoloader.php         # PSR-4 autoloader
├── 📁 languages/                 # Translation files
├── 📁 public/                    # Public-facing code
├── 📁 src/                       # Source assets
│   ├── js/                     # JavaScript source
│   ├── scss/                   # SCSS source
│   └── media/                  # Source images
├── 📁 vendor/                    # Composer dependencies
├── 📄 composer.json             # Composer configuration
├── 📄 package.json              # npm configuration
├── 📄 webpack.config.js         # Build configuration
├── 📄 init-plugin.sh           # Initialization script
└── 📄 your-plugin.php          # Main plugin file

```

🔧 Architecture &amp; Patterns
-----------------------------

[](#-architecture--patterns)

### PSR-4 Autoloading

[](#psr-4-autoloading)

```
{
  "autoload": {
    "psr-4": {
      "WordPress_Plugin_Boilerplate\\Includes\\": "includes/",
      "WordPress_Plugin_Boilerplate\\Admin\\": "admin/",
      "WordPress_Plugin_Boilerplate\\Public\\": "public/"
    }
  }
}
```

### Hook Management System

[](#hook-management-system)

```
// Centralized hook management
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
$this->loader->add_filter( 'the_content', $plugin_public, 'filter_content' );
```

### Dependency Injection

[](#dependency-injection)

- Automatic class loading via PSR-4
- Service container pattern for components
- Composer dependency management
- Plugin dependency verification

🔒 Security Best Practices
-------------------------

[](#-security-best-practices)

### Data Sanitization &amp; Validation

[](#data-sanitization--validation)

```
// Input sanitization
$clean_text = sanitize_text_field( $_POST['user_input'] );
$clean_email = sanitize_email( $_POST['email'] );
$clean_url = esc_url_raw( $_POST['url'] );

// Output escaping
echo esc_html( $user_content );
echo esc_attr( $attribute_value );
echo esc_url( $link_url );
```

### Nonce Security

[](#nonce-security)

```
// Generate nonce in forms
wp_nonce_field( 'my_action', 'my_nonce' );

// Verify nonce in processing
if ( ! wp_verify_nonce( $_POST['my_nonce'], 'my_action' ) ) {
    wp_die( 'Security check failed' );
}
```

### Capability Checks

[](#capability-checks)

```
// Always verify user permissions
if ( ! current_user_can( 'manage_options' ) ) {
    wp_die( 'Insufficient permissions' );
}
```

🌐 Internationalization (i18n)
-----------------------------

[](#-internationalization-i18n)

### Translation Setup

[](#translation-setup)

```
// Text domain registration
load_plugin_textdomain( 'your-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );

// Translation functions
__( 'Text to translate', 'your-plugin' );
_e( 'Text to echo', 'your-plugin' );
_n( 'Singular', 'Plural', $count, 'your-plugin' );
```

### Generate Translation Files

[](#generate-translation-files)

```
# Generate POT file for translators
npm run makepot

# The file will be created at: languages/your-plugin.pot
```

🚀 Deployment &amp; CI/CD
------------------------

[](#-deployment--cicd)

### GitHub Actions Integration

[](#github-actions-integration)

The boilerplate includes automated workflows for:

#### 1. Automated ZIP Creation (`build-zip.yml`)

[](#1-automated-zip-creation-build-zipyml)

- Triggers on release creation
- Builds production assets
- Creates distributable ZIP file
- Uploads as release asset

#### 2. WordPress.org Deployment (`wordpress-plugin-deploy.yml`)

[](#2-wordpressorg-deployment-wordpress-plugin-deployyml)

- Automatically deploys to WordPress.org SVN
- Handles version management
- Manages plugin assets (banners, icons)
- Supports both trunk and tagged releases

### Manual Deployment Process

[](#manual-deployment-process)

1. **Update version numbers**:

    ```
    // In main plugin file header
    Version: 1.2.3

    // In package.json
    "version": "1.2.3"
    ```
2. **Build production assets**:

    ```
    npm run build
    ```
3. **Create release**:

    ```
    git tag v1.2.3
    git push origin v1.2.3
    ```

🔧 Advanced Development
----------------------

[](#-advanced-development)

### Custom Post Types &amp; Taxonomies

[](#custom-post-types--taxonomies)

```
// Register custom post type
add_action( 'init', array( $this, 'register_post_types' ) );

public function register_post_types() {
    register_post_type( 'custom_type', array(
        'labels' => array(
            'name' => __( 'Custom Types', 'textdomain' ),
        ),
        'public' => true,
        'supports' => array( 'title', 'editor', 'thumbnail' ),
        'show_in_rest' => true, // Gutenberg support
    ) );
}
```

### REST API Endpoints

[](#rest-api-endpoints)

```
// Register custom API endpoints
add_action( 'rest_api_init', array( $this, 'register_api_routes' ) );

public function register_api_routes() {
    register_rest_route( 'my-plugin/v1', '/data', array(
        'methods' => 'GET',
        'callback' => array( $this, 'api_get_data' ),
        'permission_callback' => array( $this, 'api_permissions' ),
    ) );
}
```

### Database Integration

[](#database-integration)

```
// Custom table creation in activator.php
public static function create_tables() {
    global $wpdb;

    $table_name = $wpdb->prefix . 'my_plugin_data';

    $charset_collate = $wpdb->get_charset_collate();

    $sql = "CREATE TABLE $table_name (
        id mediumint(9) NOT NULL AUTO_INCREMENT,
        name tinytext NOT NULL,
        data longtext,
        created_at datetime DEFAULT CURRENT_TIMESTAMP,
        PRIMARY KEY (id)
    ) $charset_collate;";

    require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    dbDelta( $sql );
}
```

🎯 Performance Optimization
--------------------------

[](#-performance-optimization)

### Asset Loading Strategy

[](#asset-loading-strategy)

```
// Conditional asset loading
public function enqueue_scripts() {
    // Only load on specific pages
    if ( is_admin() && get_current_screen()->id === 'my-plugin-page' ) {
        wp_enqueue_script( 'my-plugin-admin', $this->plugin_url . 'build/js/admin.js' );
    }
}
```

### Caching Implementation

[](#caching-implementation)

```
// Use transients for expensive operations
$data = get_transient( 'my_plugin_expensive_data' );
if ( false === $data ) {
    $data = $this->expensive_operation();
    set_transient( 'my_plugin_expensive_data', $data, HOUR_IN_SECONDS );
}
```

🔗 Plugin Ecosystem
------------------

[](#-plugin-ecosystem)

### WPBoilerplate Organization

[](#wpboilerplate-organization)

Explore the complete ecosystem:

- 🏠 **Main Repository**: [WPBoilerplate/wordpress-plugin-boilerplate](https://github.com/WPBoilerplate/wordpress-plugin-boilerplate)
- 🧱 **Block Registration**: [WPBoilerplate/wpb-register-blocks](https://github.com/WPBoilerplate/wpb-register-blocks)
- 🔄 **GitHub Updater**: [WPBoilerplate/wpb-updater-checker-github](https://github.com/WPBoilerplate/wpb-updater-checker-github)
- 👥 **BuddyPress Integration**: [WPBoilerplate/wpb-buddypress-or-buddyboss-dependency](https://github.com/WPBoilerplate/wpb-buddypress-or-buddyboss-dependency)
- 🛒 **WooCommerce Integration**: [WPBoilerplate/wpb-woocommerce-dependency](https://github.com/WPBoilerplate/wpb-woocommerce-dependency)

🤝 Contributing
--------------

[](#-contributing)

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

### Development Guidelines

[](#development-guidelines)

- Follow WordPress Coding Standards (WPCS)
- Write comprehensive documentation
- Update README.md for significant changes
- Use semantic versioning for releases

📄 License
---------

[](#-license)

This project is licensed under the GPL v2 or later - see the [LICENSE.txt](LICENSE.txt) file for details.

🙏 Credits &amp; Acknowledgments
-------------------------------

[](#-credits--acknowledgments)

- **WordPress Community**: For the coding standards and best practices
- **@wordpress/scripts**: Official WordPress build tools
- **XWP**: [wp-foo-bar](https://github.com/xwp/wp-foo-bar) - Inspiration for plugin structure
- **AcrossWP**: [Development tools and packages](https://github.com/acrosswp/)
- **10up**: [GitHub Actions](https://github.com/10up/action-wordpress-plugin-build-zip) for deployment automation

---

**Made with ❤️ by the [WPBoilerplate Team](https://github.com/WPBoilerplate)**

For detailed AI agent instructions, see [agents.md](agents.md)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~5 days

Total

2

Last Release

1102d ago

Major Versions

v0.0.1 → v1.0.12023-05-03

### Community

Maintainers

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

---

Top Contributors

[![raftaar1191](https://avatars.githubusercontent.com/u/22215595?v=4)](https://github.com/raftaar1191 "raftaar1191 (147 commits)")

---

Tags

pluginwordpressdonations

### Embed Badge

![Health badge](/badges/wpboilerplate-wordpress-plugin-boilerplate/health.svg)

```
[![Health](https://phpackages.com/badges/wpboilerplate-wordpress-plugin-boilerplate/health.svg)](https://phpackages.com/packages/wpboilerplate-wordpress-plugin-boilerplate)
```

###  Alternatives

[sybrew/the-seo-framework

An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.

47078.8k](/packages/sybrew-the-seo-framework)[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.6k](/packages/afragen-git-updater)[webdevstudios/cmb2-attached-posts

Custom field for CMB2 for creating post relationships.

13565.5k](/packages/webdevstudios-cmb2-attached-posts)[alleyinteractive/pest-plugin-wordpress

WordPress Pest Integration

263.7k1](/packages/alleyinteractive-pest-plugin-wordpress)

PHPackages © 2026

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