API / Minn\Extension / Manifest

Manifest final readonly class

Minn\Extension\Manifest · public/minn/src/Minn/Extension/Manifest.php · 78 lines

minn.json, read as data. A folder under wp-content/plugins (or mu-plugins) with this file is an extension; the same folder may also be a WordPress plugin, in which case the two share a name and a version.

{ "name": "Block Visibility for Minn", "version": "1.0.0", "license": "MIT", "replaces": ["block-visibility/block-visibility.php"], "autoload": {"Minn\\Ext\\BlockVisibility\\": "src/"}, "extension": "Minn\\Ext\\BlockVisibility\\Extension", "shortcodes": ["example_tag"], "blocks": ["vendor/block"], "types": [{"slug": "zz_note", "name": "Notes", "rest_base": "zz-note"}], "needs": {"http": ["https://api.example.com/"]} }

"replaces" names the WordPress plugin files whose behaviour this extension stands in for; the extension is active whenever one of them is in active_plugins, or when its own folder is listed there, or when it is named in the minn_active_extensions option. "shortcodes" and "blocks" are the content tokens preflight treats as provided instead of missing. "types" are extra post types the engine should serve on wp/v2. "needs" says what the extension reaches outside the process: "http" is the URL prefixes its $minn->http may request (true for any public host).

Uses 1

Constants and properties

propreadonly string $slug

Promoted from the constructor.

propreadonly string $dir

Promoted from the constructor.

propreadonly string $name

Promoted from the constructor.

propreadonly string $version

Promoted from the constructor.

propreadonly string $license

Promoted from the constructor.

propreadonly array $replaces

Promoted from the constructor.

propreadonly array $autoload

Promoted from the constructor.

propreadonly string $extension

Promoted from the constructor.

propreadonly string $covers

what of the replaced plugin this provides, when not all of it

Promoted from the constructor.

propreadonly array $shortcodes

Promoted from the constructor.

propreadonly array $blocks

Promoted from the constructor.

propreadonly array $types

Promoted from the constructor.

propreadonly ?array $http

Promoted from the constructor.

Public

new__construct(string $slug, string $dir, string $name, string $version, string $license, array $replaces, array $autoload, string $extension, string $covers = '', array $shortcodes = array ( ), array $blocks = array ( ), array $types = array ( ), ?array $http = NULL)#
$replaceslist<string>
$autoloadarray<string, string>namespace prefix => directory
$shortcodeslist<string>
$blockslist<string>
$typeslist<array<string, mixed>>
staticread(string $dir): ?self#

A folder's minn.json, or null when there is none.

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatehttp(mixed $asked): ?array#

needs.http as a grant: true for any public host, or a URL prefix (or a list of them) every request must start with; null when the manifest does not ask. A prefix naming only a host is closed with "/", so https://api.example.com does not also admit api.example.com.evil.net.

@return list<string>|null