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:
| Package | Provides | Documented in |
|---|---|---|
bitapps/wp-kit | Router, Request, Response, middleware plumbing, hooks, shortcodes, migrations, HTTP client, helpers | The Basics, HTTP Client, Helpers |
bitapps/wp-database | ActiveRecord ORM, query builder, schema builder over $wpdb | Database |
bitapps/wp-validator | Validation rules and sanitizers | Validation |
{
"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;
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:
| Namespace | Contents |
|---|---|
Http\Router | Route, routers, route registration |
Http\Request | The request object and validation entry point |
Http\Response | The response envelope |
Http\Client | Outbound HTTP client |
Helpers | Arr, JSON, Slug, DateTimeHelper |
Hooks | Action and filter wrappers |
Shortcode | Shortcode registration |
Migration | Migration base class and runner |
Utils\Capabilities | Capability checks |
Configs\JsonConfig | JSON decode behavior for the kit |
Installer | Activation 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.