QuickWP ? WordPress REST API Toolkit (v3)

QuickWP is a zero-dependency PHP 8.3+ toolkit, multi-site CLI, MCP server, and lightweight editorial web console for managing WordPress sites via the REST API.
? Installation
composer require bitshost/quickwp
Or clone the repository and install dev tools:
git clone https://github.com/bitshost/quickwp.git
cd quickwp
composer install
? Requirements
-
PHP 8.3+ with `ext-curl` and `ext-json`
-
WordPress site with REST API enabled (WordPress 5.6+ for Application Passwords; 5.9+ for Menus API)
? Features
-
Clean OOP SDK (
src/) ? PSR-4 autoloaded services (`AbstractService`, `RestClientInterface`) with retry/backoff (`429`/`5xx`) and automatic pagination (`listAll()`).
-
Multi-Site Native ? Manage multiple WordPress sites (`quick-sites.php`) from a single installation via SDK, Web UI, CLI, or MCP.
-
Full WordPress Resource Coverage ? Posts, Pages, Custom Post Types, Media (web & local disk upload), Taxonomies, Menus, Templates, Users, Comments, Health Diagnostics, ACF/Meta fields, and Cross-Site Sync.
-
Multi-Site CLI (
bin/quickwp) ? `site:list`, `site:check --all`, `post:list`, `post:create --file=article.md`, `media:upload`, `export`, `sync`, and `ai:draft` with global `--json` output.
-
Outbound Webhooks ? Optional HMAC-SHA256 signed event notifications (`post.published`, `page.published`, `*`) for n8n, Make, Zapier, Slack, Telegram, or social automation.
-
Local MCP Server (
bin/quickwp-mcp) ? Native JSON-RPC 2.0 `stdio` server exposing 11 draft-first WordPress tools to Antigravity, Claude Desktop, or Cursor without putting credentials in prompts.
-
AI Concierge (Optional, Multilanguage) ? Provider-agnostic (`Gemini`, `OpenAI`, or local `Ollama`, with automatic Google AI Studio / Vertex Express routing) voice/text draft generator and existing Post/Page refiner (`draft_copy` / `update` / `preview`) with Type/Status filters and strict draft-first workflow.
-
Lightweight Editorial Web UI (
public/) ? Zero-build vanilla JS HTML toolbar with Write/Split/Preview, visual Media Picker modal, Recent Drafts review card with 1-click Publish, Quick Edit live title search + Status filter, Schedule/Author/Sticky/ACF controls, Menus, Comments, zero-dependency UI i18n (EN / RO switcher), CSRF protection, and hardened `AccessControl`.
? Project Structure
QuickWP/
??? bin/
? ??? quickwp # Multi-site CLI tool
? ??? quickwp-mcp # Local MCP stdio server for AI agents / IDEs
??? src/ # Core library (PSR-4: QuickWP\)
? ??? QuickWP.php # Main facade
? ??? Bootstrap.php # Service factory
? ??? Ai/
? ? ??? AiConciergeService.php # Multilingual draft-first AI Concierge
? ??? Cli/
? ? ??? Application.php # CLI command runner
? ??? Config/
? ? ??? Config.php # Immutable config wrapper
? ? ??? ConfigLoader.php # Loads & merges quick-config.php / quick-sites.php
? ? ??? SiteConfig.php # Endpoints, credentials, webhooks & AI config
? ??? Content/
? ? ??? MarkdownParser.php # Zero-dep Frontmatter + Markdown -> HTML
? ??? Http/
? ? ??? AccessControl.php # Timing-safe Basic / Token + session auth
? ? ??? CsrfProtection.php # Session-backed CSRF token guard
? ? ??? RestClient.php # cURL client with retry/backoff & local uploads
? ? ??? RestClientInterface.php
? ? ??? SessionHelper.php # Unified secure session startup (HTTPS-aware)
? ??? I18n/
? ? ??? Translator.php # Zero-dep UI localization (lang/*.php, fallback en)
? ??? Mcp/
? ? ??? McpServer.php # JSON-RPC 2.0 MCP server (11 tools)
? ??? Service/
? ? ??? AbstractService.php # Shared CRUD helpers & listAll() pagination
? ? ??? PostService.php # Posts CRUD + ACF/Meta + listAll()
? ? ??? PageService.php # Pages CRUD + ACF/Meta + listAll()
? ? ??? CptService.php # Custom Post Types CRUD + ACF/Meta + listAll()
? ? ??? MediaService.php # $_FILES & uploadFromPath() + Featured Image
? ? ??? TaxonomyService.php # Categories, tags & custom taxonomies
? ? ??? MenuService.php # WordPress 5.9+ navigation menus & items
? ? ??? TemplateService.php # Schema-discovered + configured templates
? ? ??? UserService.php # Users & /users/me?context=edit
? ? ??? CommentService.php # Comments CRUD + approve/unapprove/spam
? ? ??? HealthService.php # REST reachability + auth + latency check
? ? ??? SyncService.php # Cross-site post/page sync (staging -> prod)
? ??? Webhook/
? ??? WebhookDispatcher.php # Outbound JSON webhooks with HMAC-SHA256
??? lang/ # UI translations (en.php, ro.php; auto-discovered)
??? public/ # Editorial Web UI (zero npm/build)
? ??? index.php # Dashboard + AI Concierge + Recent Drafts + Health Check
? ??? quick-post.php # 2-column Post editor + Live Preview + Media Picker
? ??? quick-page.php # 2-column Page editor + Live Preview + Media Picker
? ??? quick-edit.php # Quick Edit with live title search, Status filter & Preview
? ??? quick-list.php # Browse content + Quick Status Tabs + 1-click Publish + Bulk
? ??? quick-media.php # Upload Media + visual Media Library Browser
? ??? quick-cpt.php # Custom Post Types
? ??? quick-taxonomy.php # Categories & Tags
? ??? quick-menus.php # Navigation Menus Manager
? ??? quick-comments.php # Comments Moderation
? ??? media-proxy.php # Same-origin JSON proxy for Media Picker modal
? ??? assets/ # style.css, editor.js, taxonomy-picker.js
? ??? partials/ # bootstrap.php, header.php, footer.php, site-switcher.php
??? docs/ # Detailed guides
??? tests/ # PHPUnit 11 test suite (81 tests)
??? quick-config.example.php # Configuration template
??? quick-sites.example.php # Multi-site configuration template
? Quick Start
-
Copy the example config:
cp quick-config.example.php quick-config.php
-
Create an Application Password in WordPress (Users ? Profile ? Application Passwords) and add it to `quick-config.php`.
-
Verify your connection via CLI:
php bin/quickwp site:check --all
-
Or start the local web console:
php -S localhost:8000 -t public
? Programmatic Usage
<?php
require_once __DIR__ . '/vendor/autoload.php';
use QuickWP\QuickWP;
$qwp = QuickWP::init(__DIR__, siteKey: 'main', enforceAccess: false);
// Optional: enable automatic retries on 429 / 502 / 503 / 504
$qwp->getClient()->setMaxRetries(maxRetries: 2, baseDelayMs: 250);
// Create a post with ACF & Meta fields
$result = $qwp->posts()->create([
'title' => 'Hello from QuickWP v3',
'content' => '<p>Clean REST publishing.</p>',
'status' => 'draft',
'acf' => ['subtitle' => 'Fast and simple'],
]);
if (QuickWP::isSuccess($result)) {
echo 'ID: ' . QuickWP::getId($result) . ' | ' . QuickWP::getLink($result);
} else {
echo 'Error: ' . QuickWP::getError($result);
}
// Fetch all pages automatically across X-WP-TotalPages
$allPosts = $qwp->posts()->listAll(['status' => 'publish']);
// Upload a local file from CLI / scripts
$media = $qwp->media()->uploadFromPath('/path/to/cover.jpg', ['alt_text' => 'Cover']);
// Health check, users & comment moderation
$health = $qwp->health()->check();
$me = $qwp->users()->me();
$approved = $qwp->comments()->approve(42);
// AI Concierge (draft-first, multilingual)
$draft = $qwp->ai()->draftFromPrompt('Write a short summary in English about QuickWP v3');
? API Reference (Facade)
| Method | Description |
|--------|-------------|
| QuickWP::init($baseDir, $siteKey, $enforceAccess) | Initialize from quick-config.php / quick-sites.php |
| QuickWP::withConfig($array) | Initialize from an explicit config array |
| $qwp->posts() | PostService (create, update, get, list, listAll, delete) |
| $qwp->pages() | PageService (create, update, get, list, listAll, delete) |
| $qwp->cpt() | CptService (create, update, get, list, listAll, delete) |
| $qwp->media() | MediaService (upload, uploadFromPath, setFeaturedImage, get, list, listAll, update, delete) |
| $qwp->taxonomy() | TaxonomyService (createCategory, createTag, create, update, get, list, listAll, delete) |
| $qwp->menus() | MenuService (getNavMenus, createNavMenu, getMenuItems, createMenuItem, deleteMenuItem, ?) |
| $qwp->templates() | TemplateService (getPageTemplates, getPostTemplates) |
| $qwp->users() | UserService (me, get, list, listAll) |
| $qwp->comments() | CommentService (list, listAll, get, create, update, approve, unapprove, spam, delete) |
| $qwp->health() | HealthService (check) |
| $qwp->webhooks() | WebhookDispatcher (dispatch, getTargetsForEvent) |
| $qwp->ai() | AiConciergeService (draftFromPrompt, parseDraftJson) |
?? Configuration Reference
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| posts_endpoint | string | '' | WordPress posts REST endpoint |
| pages_endpoint | string | '' | WordPress pages REST endpoint |
| media_endpoint | string | derived | Media endpoint (auto-derived if empty) |
| categories_endpoint / tags_endpoint | string | derived | Taxonomy endpoints |
| users_endpoint / comments_endpoint | string | derived | Users & comments endpoints |
| wp_username / wp_app_password | string | '' | WordPress Application Password credentials |
| verify_ssl | bool | true | Verify SSL certificates |
| access_mode | string | 'none' | Web UI access control: none, basic, or token |
| access_basic_user / access_basic_password | string | '' | HTTP Basic Auth credentials (timing-safe hash_equals) |
| access_token | string | '' | Token auth (?token=, X-QuickWP-Token, persisted in session) |
| webhooks | array | [] | Outbound webhook map (event => url or url[], supports '*') |
| webhook_secret | string | '' | Optional HMAC-SHA256 secret for X-QuickWP-Signature |
| ai_provider | string | '' | Optional AI Concierge provider: gemini, openai, ollama |
| ai_api_key | string | '' | Provider API key (not required for local Ollama) |
| ai_model | string | provider default | Model override (gemini-3.5-flash-lite, gpt-4o-mini, llama3.2) |
| ai_endpoint | string | '' | Optional custom endpoint (e.g. http://localhost:11434) |
? Documentation
? Development
# Run PHPUnit 11 test suite (70 tests)
composer test
# Run PHPStan 2 static analysis (Level 8)
composer analyse
? License
MIT License ? see LICENSE for details.