jdz / adminkit
Framework-agnostic admin list/item orchestration primitives: pagination, filter-state resolution, ordering validation, query building, uniqueness and data sanitization
Requires
- php: >=8.2
- jdz/database: ^2.1
- jdz/form: ^1.0
Requires (Dev)
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2026-07-10 11:18:54 UTC
README
Framework-agnostic primitives for building admin list/edit screens. No HTTP, session, view or ORM coupling — you feed each helper plain values from whatever framework you run (Slim, Symfony, …) and get back a computed result.
Built on jdz/database (query building)
and jdz/form (form data).
What's in the box
| Class | Purpose |
|---|---|
List\Paginator |
Clamp a requested page against a total and derive the SQL offset |
List\FilterStateResolver |
Merge defaults < stored < request < forced filter state; inject token/page/ordering |
List\OrderingValidator |
Decide whether drag-and-drop reordering is allowed for the current list |
List\SearchTerm |
Split a CODE:text search string |
Query\AdminQuery |
SelectQuery with category / version / keyword select+filter helpers |
Item\UniquenessChecker |
"is this column value already taken" against a DatabaseInterface |
Item\DataSanitizer |
Coerce posted form values to match their column definitions before save |
Example
use JDZ\AdminKit\List\Paginator; $p = new Paginator(total: 128, page: 3, limit: 20); $p->start; // 40 (SQL offset) $p->nbPages; // 7 $p->page; // 3 (clamped if out of range)
Scope
Orchestration only — data access, HTTP, view rendering and the admin UI value
objects (jdz/adminui) stay in the
consuming framework. Row assembly and view-payload building are intentionally
NOT part of this package: they are tightly coupled to per-app rendering hooks
and belong with the consumer.
Tests
composer test