Download the PHP package plugin-sdk/wp without Composer
On this page you can find all versions of the php package plugin-sdk/wp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download plugin-sdk/wp
More information about plugin-sdk/wp
Files in plugin-sdk/wp
Package wp
Short Description Plugin SDK — WordPress runtime: declarative manifest loader, fluent Settings API, REST routes with JSON-schema validation, dbDelta migrations, plus admin-UI render helpers.
License Apache-2.0
Homepage https://plugin-sdk.com
Informations about the package wp
plugin-sdk/wp
Read-only mirror. This repository is auto-generated from the
packages/wp-composer/subdirectory of artificialpoets/plugin-sdk by agit subtree splitGitHub Action on every tagged release.File issues + PRs against the main repo, not here. The mirror is rebuilt on every release; any commits pushed directly here will be overwritten.
The WordPress runtime for Plugin SDK — a declarative manifest loader, fluent Settings/REST/Migration APIs, plus the admin-UI render helpers. Drop a plugin-sdk.json in your plugin root, call Plugin::fromManifest() once, and the SDK wires up:
- the settings page (with capability check + sanitisation per field),
- the REST API (with cap check + JSON-schema body validation),
- and the database tables (rendered to dbDelta SQL, run on activate),
…then gets out of your way for handlers and business logic.
Pair with @plugin-sdk/wp-core-css for the stylesheet.
Install
Requires PHP 7.4 or later.
Declarative quickstart
Add a plugin-sdk.json to your plugin root:
In your plugin's main PHP file:
That's the whole bootstrap. Errors in the manifest throw ConfigException with the full validation trace, so you fail fast at boot time instead of hitting a half-broken admin page later.
Fluent runtime (imperative layer)
The declarative loader compiles to the same fluent calls — you can use either layer or both.
Admin UI render helpers
The package also includes the original render helpers — useful for hand-rolled admin pages that don't fit the settings model:
The rendered HTML uses real WordPress admin class names — .wrap, .notice notice-success is-dismissible, .form-table, .button button-primary, etc. — so plugin admin pages look indistinguishable from a native WP screen and inherit the user's color scheme automatically.
Available helpers
All methods live on \PluginSDK\WP\Components as static methods. Each underlying renderer is also available directly (e.g. \PluginSDK\WP\Components\Button::render()).
Actions
button(string $label, array $args = [])— variantsprimary/secondary/link/link-delete, sizessmall/large/hero. Passhtml_labelto use pre-rendered HTML (e.g. for icons + text).
Icons
dashicon(string $icon, array $args = [])— WordPress's native icon font. Pass any name from the Dashicons catalog, e.g.'admin-users'or'edit'. Sizes:'small'(16px), default (20px),'large'(28px).icon(string $name, array $args = [])— Inline SVG, the modern WP direction. 20 built-in names (plus / minus / close / check / chevrons / arrows / edit / trash / search / more-horizontal / more-vertical / info / warning / external-link). Passsvg_htmlto supply your own inline SVG content.
Notice
notice(string $variant, string $message_html, array $args)— pass pre-escaped HTMLnotice_success(string $message, array $args)— convenience wrapper that escapes a single-line messagenotice_error(),notice_warning(),notice_info()
Forms
input(array $args)— widthregular/large/small, type, name, value, etc.textarea(array $args)select(array $options, array $args)form_table(string $rows_html),form_row(string $label, string $control_html, array $args)description(string $text)—<p class="description">help_tip(string $tip)—?icon with hover tooltiptoggle(array $args)— Gutenberg-style switchsubmit(string $children_html)—<p class="submit">wrapper
Navigation
nav_tabs(array $tabs)—[['label' => …, 'href' => …, 'active' => true], …]subsubsub(array $items)— status filter row
Layout
wrap(string $inner_html),page_header(string $title, array $args)two_column(string $main_html, string $sidebar_html)screen_options(string $children_html, bool $open = false)help_tabs(array $tabs, ?string $active_id = null)
Data display
postbox(string $title, string $inside_html)welcome_panel(array $args)stat_card(array $args)—label,value,delta,trend(up/down)activity_item(array $args)
Tables
list_table(string $inner_html, array $args),row_actions(array $actions)bulk_actions(array $actions, array $args)search_box(array $args),pagination(array $args)empty_state(array $args)
Feedback
status_badge(string $label, string $variant)—active/error/warning/info/neutralspinner(bool $active = true)pointer(array $args),skeleton(string $variant)
Asset enqueue
Assets::enqueue_cdn()— loads the Plugin SDK bundle fromhttps://cdn.wp-admincss.com/css/latest.cssAssets::enqueue_local(string $url)— loads the Plugin SDK bundle from a URL you controlAssets::enqueue_dashicons()— callswp_enqueue_style('dashicons'). Prefer this over the bundled CSS when inside WordPress; avoids the external CDN request.
Example
See examples/settings-page.php for a complete plugin admin page demonstrating most components.
Security
The declarative runtime bakes in capability checks (via current_user_can), nonce verification (settings forms use WP's options.php round-trip), and per-field sanitisation. REST routes run JSON-schema validation before the handler executes — a malformed body is rejected with a rest_invalid_body 400 response, never reaching your code.
Every render helper accepting user-controllable strings (label, title, message, URL, attribute value) runs them through esc_html() / esc_attr() / esc_url() (with safe fallbacks when WordPress functions aren't loaded). Methods that take pre-rendered HTML (e.g. notice() with $message_html) are documented as such — escape inputs yourself with \PluginSDK\WP\Html::esc() if they're user-controllable.
Tests
Zero-dep PHP test harness — no PHPUnit needed:
Tests run against WP-function stubs that capture invocations, so the runtime can be unit-tested without WordPress installed.
License
Apache 2.0. See the LICENSE at the repo root.
All versions of wp with dependencies
ext-json Version *