Skip to main content

Packages

Introduction

The boilerplate is thin. Almost everything documented here comes from three 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
{
"require": {
"php": ">=8.0",
"bitapps/wp-kit": "^2.0",
"bitapps/wp-database": "^2.0",
"bitapps/wp-validator": "^1"
}
}

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;

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
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.

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.