PHPackages                             plugin-sdk/wp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. plugin-sdk/wp

ActiveLibrary[HTTP &amp; Networking](/categories/http)

plugin-sdk/wp
=============

Plugin SDK — WordPress runtime: declarative manifest loader, fluent Settings API, REST routes with JSON-schema validation, dbDelta migrations, plus admin-UI render helpers.

v0.1.0-rc.1(2mo ago)017Apache-2.0PHPPHP &gt;=7.4

Since May 25Pushed 2mo agoCompare

[ Source](https://github.com/artificialpoets/plugin-sdk-wp)[ Packagist](https://packagist.org/packages/plugin-sdk/wp)[ Docs](https://plugin-sdk.com)[ RSS](/packages/plugin-sdk-wp/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (3)Used By (0)

plugin-sdk/wp
=============

[](#plugin-sdkwp)

> **Read-only mirror.** This repository is auto-generated from the `packages/wp-composer/` subdirectory of [artificialpoets/plugin-sdk](https://github.com/artificialpoets/plugin-sdk)by a `git subtree split` GitHub 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`](https://github.com/artificialpoets/plugin-sdk/tree/main/packages/wp-core-css) for the stylesheet.

Install
-------

[](#install)

```
composer require plugin-sdk/wp
```

Requires PHP 7.4 or later.

Declarative quickstart
----------------------

[](#declarative-quickstart)

Add a `plugin-sdk.json` to your plugin root:

```
{
  "$schema": "https://cdn.wp-admincss.com/wordpress/plugin-sdk.schema.json",
  "platform": "wordpress",
  "name": "Acme Forms",
  "slug": "acme-forms",
  "textDomain": "acme-forms",
  "version": "0.1.0",
  "namespace": "Acme\\Forms",

  "settings": {
    "page": {
      "title": "Acme Forms",
      "capability": "manage_options",
      "sections": [{
        "id": "general",
        "title": "General",
        "fields": [
          { "id": "api_key", "label": "API Key", "type": "password", "required": true }
        ]
      }]
    }
  },

  "rest": {
    "namespace": "acme-forms/v1",
    "routes": [{
      "path": "/submissions",
      "method": "POST",
      "capability": "manage_options",
      "handler": "Acme\\Forms\\REST\\Submissions::create",
      "schema": {
        "type": "object",
        "required": ["email"],
        "properties": { "email": { "type": "string", "format": "email" } }
      }
    }]
  },

  "database": {
    "tables": [{
      "name": "submissions",
      "columns": [
        { "name": "id", "type": "BIGINT UNSIGNED", "primary": true, "autoIncrement": true },
        { "name": "email", "type": "VARCHAR(255)", "notNull": true },
        { "name": "created_at", "type": "DATETIME", "notNull": true, "default": "CURRENT_TIMESTAMP" }
      ]
    }]
  }
}
```

In your plugin's main PHP file:

```
