Skip to main content

Packages

Introduction​

The boilerplate is thin. Almost everything documented here comes from four Composer packages, all installed as normal dependencies and namespace-prefixed at build time:

PackageProvidesDocumented in
bitapps/wp-kitRouter, Request, Response, middleware plumbing, hooks, shortcodes, migrations, HTTP client, helpersThe Basics, HTTP Client, Helpers
bitapps/wp-databaseActiveRecord ORM, query builder, schema builder over $wpdbDatabase
bitapps/wp-validatorValidation rules and sanitizersValidation
bitapps/wp-telemetryOpt-in usage reporting and deactivation feedbackTelemetry
{
"require": {
"php": ">=8.0",
"bitapps/wp-kit": "^2.0",
"bitapps/wp-database": "^2.0",
"bitapps/wp-validator": "^1",
"bitapps/wp-telemetry": "^0"
}
}

Namespace prefixing​

Dependencies are prefixed at build time so two plugins shipping different versions of the same package cannot collide. That is why every import from a package carries a Deps\ segment:

use YourPlugin\Deps\BitApps\WPKit\Http\Response;
use YourPlugin\Deps\BitApps\WPDatabase\Model;
use YourPlugin\Deps\BitApps\WPValidator\Rule;
use YourPlugin\Deps\BitApps\WPTelemetry\Telemetry\Telemetry;

Your own classes are not prefixed:

use YourPlugin\HTTP\Controllers\TagController;
use YourPlugin\Model\Tag;
note

The Deps\ segment is generated. Import the prefixed path in plugin code, but read the packages' own source and issues under their real namespaces — BitApps\WPKit\....

wp-kit​

The framework layer. Beyond HTTP, it carries:

NamespaceContents
Http\RouterRoute, routers, route registration
Http\RequestThe request object and validation entry point
Http\ResponseThe response envelope
Http\ClientOutbound HTTP client
Http\DetectionClientIpResolver, UserAgent — see Client IP
ContainerIoC container and service providers
SettingsTyped settings schema and repository
CacheCache stores and facade
CronWP-Cron scheduler
HelpersArr, JSON, Slug, DateTimeHelper
HooksAction and filter wrappers
ShortcodeShortcode registration
MigrationMigration base class and runner
Utils\CapabilitiesCapability checks
Configs\JsonConfigJSON decode behavior for the kit
InstallerActivation and uninstall wiring

wp-database​

An ActiveRecord ORM and fluent query builder over $wpdb. Models map to tables, results hydrate into a Collection, and every value is bound through $wpdb->prepare(). See Database.

wp-validator​

Rule-based validation with WordPress sanitizers built in. Reached through $request->validate() rather than constructed directly. See Validation.

wp-telemetry​

Consent UI, weekly usage reports and an optional deactivation-feedback dialog. The plugin supplies the receiving server and privacy links, and can filter the payload before it is sent. See Telemetry.

Starter template​

wp-plugin-starter scaffolds a plugin with this architecture already wired, and its wp-kit CLI generates controllers, models and migrations. See Installation for requirements and setup.