PHP · WORDPRESS & CLOUDFLARE D1
wp-cloudflare-d1 — WordPress & PHP Client for Cloudflare D1 Serverless SQLite
wp-cloudflare-d1 connects WordPress sites to Cloudflare D1 serverless SQLite databases at the network edge for offloading high-volume analytics, logs, and read-heavy catalogs. It provides parameterized SQL query builders, batch statement execution, and WordPress HTTP API connection pooling.
$ composer require bhubbard/wp-cloudflare-d1
Copy
GitHub ↗
Prepared Statements
100% SQLi Safe
Batch Queries
Single HTTP Roundtrip
WP_Error Native
Strict Error Handling
Edge Read Replicas
Global D1 Sessions
01. Interactive Workbench
02. Reference Implementation
03. Architecture & Specs
Interactive WordPress -> Cloudflare D1 Prepared Statement & Batch Builder
Parameterized SQL Query & Bound Values
D1 Execution Mode
Single Parameterized Query (`/d1/database/{id}/query`)
Atomic Multi-Statement Batch Transaction (`batch()`)
Read-Through WordPress Object Cache (`wp_cache_get` + D1 Fallback)
Inspect D1 Meta Telemetry (`rows_read`, `rows_written`, `duration_ms`)
Execute Pipeline ▶
Reset
Deterministic Execution Output & Telemetry
STATUS: READY // 0 ERRORS
PHP (WP Cloudflare D1 Client)
$d1 = new \BHubbard\CloudflareD1\Client(
account_id: defined( 'CF_ACCOUNT_ID' ) ? CF_ACCOUNT_ID : '',
database_id: defined( 'CF_D1_DATABASE_ID' ) ? CF_D1_DATABASE_ID : '',
api_token: defined( 'CF_API_TOKEN' ) ? CF_API_TOKEN : ''
);
$result = $d1->query(
'SELECT id, event_type, created_at FROM edge_audit_log WHERE site_id = ? AND severity = ? LIMIT 25',
[ get_current_blog_id(), 'critical' ]
);
Production Engineering Specifications
Repository: https://github.com/bhubbard/wp-cloudflare-d1
Live Studio: https://code.brandonhubbard.com/wp-cloudflare-d1/
Portal: https://code.brandonhubbard.com/
Install: composer require bhubbard/wp-cloudflare-d1
Design System: Brandon Hubbard Swiss Modernist (#0A0A0C / 1px Exposed Structural Grid)