# BaseCloud Boost

[![WordPress Plugin Version](https://img.shields.io/badge/version-1.0.3-blue.svg)](https://wordpress.org/plugins/basecloud-boost/)
[![License](https://img.shields.io/badge/license-GPL--2.0-green.svg)](https://www.gnu.org/licenses/gpl-2.0.html)
[![WordPress](https://img.shields.io/badge/wordpress-5.5%2B-blue.svg)](https://wordpress.org/)
[![PHP](https://img.shields.io/badge/php-7.4%2B-purple.svg)](https://www.php.net/)

World-class page caching, asset optimization, and performance acceleration for WordPress — by BaseCloud.

## Features

### Page Cache
- Full-page HTML caching with GZIP and Brotli compression variants
- Smart cache invalidation on post updates, comments, and taxonomy changes
- Configurable cache lifetime (default: 24 hours)
- Separate mobile device cache
- Cache exclusion by URL pattern or cookie name
- Advanced Cache drop-in (`advanced-cache.php`) for zero-PHP serving

### Asset Optimization
- HTML, CSS, and JavaScript minification
- CSS and JS file combining with dependency ordering
- JavaScript defer and delay strategies
- Critical CSS extraction and inline injection
- Remove query strings from static asset URLs
- Google Fonts optimization with `font-display=swap`

### Media Optimization
- Native lazy loading for images, iframes, and videos
- WebP and AVIF next-gen image serving
- YouTube and Vimeo video facade (click-to-play thumbnails)

### Cache Preloader
- Automatic sitemap-based URL discovery
- Background batch processing
- Real-time progress tracking in the admin dashboard

### CDN Integration
- Generic CDN hostname rewriting
- Cloudflare API cache purging
- BunnyCDN API cache purging and URL rewriting

### Database Optimization
- Post revision cleanup
- Auto-draft and trashed item removal
- Expired transient removal
- Orphaned postmeta cleanup
- Table optimization (OPTIMIZE TABLE)

### Security Headers
- X-Content-Type-Options, X-Frame-Options, Referrer-Policy
- Permissions-Policy (FLoC/Topics API opt-out)
- Strict-Transport-Security (HSTS)

### Developer API
- Full WordPress hook API for extending caching and CDN behaviour
- WP-CLI support for cache management from the command line
- PSR-4 autoloaded architecture

## Requirements

- **WordPress**: 5.5 or higher
- **PHP**: 7.4 or higher

### Optional
- Cloudflare account with Cache Purge API token
- BunnyCDN account with Pull Zone API key
- Custom webhook endpoint for performance metrics

## Installation

### From WordPress.org (Recommended)
1. Go to **Plugins > Add New** in your WordPress admin.
2. Search for **BaseCloud Boost**.
3. Click **Install Now**, then **Activate**.
4. Navigate to **BaseCloud Boost > Dashboard** and enable Page Cache.

### Manual Installation
1. Download the latest release.
2. Upload the `basecloud-boost` folder to `/wp-content/plugins/`.
3. Activate via **Plugins > Installed Plugins**.
4. Navigate to **BaseCloud Boost > Dashboard** to configure.

## Configuration

### Enable Page Cache
1. Go to **BaseCloud Boost > Page Cache**.
2. Toggle **Enable Page Cache** on.
3. Set your preferred cache lifetime.
4. Save settings.

### Cloudflare Integration
1. Go to **BaseCloud Boost > CDN**.
2. Enable **Cloudflare** and enter your Zone ID and API Token.
3. Save settings — the plugin will purge Cloudflare automatically on every cache clear.

### BunnyCDN Integration
1. Go to **BaseCloud Boost > CDN**.
2. Enable **BunnyCDN** and enter your API Key and Pull Zone ID.
3. Optionally set a CDN hostname for URL rewriting.
4. Save settings.

### Performance Metrics Webhook
1. Go to **BaseCloud Boost > Advanced**.
2. Enter your webhook URL.
3. Optionally enter a shared secret for HMAC-SHA256 payload signing.
4. Save settings — metrics are sent daily and on demand via the test button.

## External Services

BaseCloud Boost may connect to the following external services. **No data is sent by default** — each integration requires explicit configuration.

| Service | When Used | Data Sent |
|---|---|---|
| Cloudflare Cache Purge API | When Cloudflare CDN is enabled and a cache purge is triggered | URLs to purge, Zone ID (via API token) |
| BunnyCDN Cache Purge API | When BunnyCDN is enabled and a cache purge is triggered | URLs to purge, API key |
| Custom Webhook | When a webhook URL is configured (daily cron + manual test) | Cache metrics, site URL, site name (no user data) |

See `readme.txt` for full external services disclosure as required by WordPress.org.

## Repository Structure

```
basecloud-boost/
├── basecloud-boost.php          # Main plugin file
├── advanced-cache.php           # Page cache drop-in (copied to wp-content on activation)
├── bcboost-config.php               # Default option values
├── uninstall.php                # Cleanup on plugin deletion
├── readme.txt                   # WordPress.org readme
├── README.md                    # This file
├── admin/
│   ├── css/                     # Admin stylesheet
│   ├── js/                      # Admin JavaScript
│   └── views/                   # Admin page templates
│       ├── dashboard.php
│       ├── page-cache.php
│       ├── file-optimization.php
│       ├── media.php
│       ├── preload.php
│       ├── cdn.php
│       ├── database.php
│       ├── security.php
│       ├── advanced.php
│       ├── tools.php
│       ├── lighthouse.php
│       ├── webhook.php
│       └── partials/
└── includes/
    ├── Plugin.php               # Main plugin bootstrap singleton
    ├── Activator.php            # Activation tasks
    ├── Deactivator.php          # Deactivation tasks
    ├── Admin/                   # Admin controller and settings API
    ├── CDN/                     # Cloudflare and BunnyCDN integrations
    ├── CLI/                     # WP-CLI commands
    ├── Compatibility/           # Host, multisite, WooCommerce, and plugin compat
    ├── Core/                    # Cache engine, page cache, preloader, purge, metrics
    ├── Database/                # DB optimizer
    └── Optimizer/               # HTML, CSS, JS, image, font, and lazy load optimizers
```

## License

This plugin is licensed under the [GPL v2 or later](https://www.gnu.org/licenses/gpl-2.0.html).

```
BaseCloud Boost — Performance Acceleration for WordPress
Copyright (C) 2026 BaseCloud

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
```

## Support

- **WordPress.org Forums**: https://wordpress.org/support/plugin/basecloud-boost/
- **Website**: https://basecloud.co

---

Made by [BaseCloud](https://basecloud.co)
