detain / phlix-plugin-example
Hello-world metadata provider — reference plugin for Phlix authors.
Package info
github.com/detain/phlix-plugin-example
Type:phlix-plugin
pkg:composer/detain/phlix-plugin-example
Requires
- php: >=8.3
- detain/phlix-shared: ^0.21.0
- psr/container: ^2.0
Requires (Dev)
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-03 05:39:52 UTC
README
Reference metadata-provider plugin for Phlix — the smallest plugin that demonstrates the wiring a real host (the running
phlix-serverinstance) consults.
This repo is the canonical hello-world template for Phlix plugin authors. It does almost nothing on purpose — but it is wired exactly like a real plugin:
- it implements the three shared contracts a metadata provider is
consulted through (
LifecycleInterface+ConfigurableInterface+MetadataSourceInterface); - it answers the metadata triad with a fixed greeting for one
well-known fixture, and delivers the manifest
greetingsetting throughconfigure(); - it ships with a CI workflow plus PHPUnit tests, so you can fork it as a starter.
Read "What it does" below for the call-path tour — lookup() is
a didactic helper the host never calls, and the live call paths are
named there.
What it does
The host drives this plugin through three contracts, all implemented:
- Lifecycle —
Phlix\Shared\Plugin\LifecycleInterface(onEnable(),onDisable(),subscribedEvents()): the instantiate/enable/disable contract the loader runs every plugin through. - Settings delivery —
Phlix\Shared\Plugin\ConfigurableInterface(configure(array $settings)). Per the loader's own words this is "the ONLY channel by which a plugin receives its configured API keys/options" (Phlix\Plugins\PluginLoaderinphlix-server, applied once between construction andonEnable()). That is how an operator'sgreetingchange reaches the instance:plugin.jsonseeds the persisted settings store at install, the admin Plugins panel edits the stored value, andconfigure()delivers that store — and it is the seam this template exists to demonstrate. The ordering ceremony is pinned from both sides:test_recording_entry_observes_configure_before_on_enable()replays the loader's call order through a recording entry double, andtest_configured_greeting_survives_the_enable_ceremony()drives the real provider throughconfigure()→onEnable()and reads the delivered greeting back. - Metadata pipeline —
Phlix\Shared\Metadata\MetadataSourceInterface(sourceName(),supportedMediaTypes(),search(),getDetails(),getImages()).PluginLoader::enable()registers an entry instance into the metadataSourceRegistryonly when it isinstanceofthat interface — a clone that drops it installs and enables but is never consulted.
Through the triad, the reference source is example
(sourceName(), the slug an admin adds to a
metadata.provider_priority list), it is registered for movie
items (supportedMediaTypes()), and its methods answer as follows:
search('hello')returns[['id' => 'hello', 'title' => 'Hello, World']]— the fixture, best-match first; any other query returns[].getDetails('hello')returns['title' => 'Hello, World']; any other id returns[]. It routes throughlookup(), below, so the fixture shape lives in one place.getImages()always returns[]— the reference ships no artwork, and an empty map is the contract-legal way to say so.
lookup()is a didactic method: the host never calls it. There is no plugin-entrylookup()call site anywhere inphlix-server/src. It is the shape this template shipped before the triad wiring landed, kept as the fixture helpergetDetails()delegates to — callinglookup('/test/hello.mkv')returns['title' => 'Hello, World'](any other path[]), but the live path into that code is the triad above. Forkers replace the triad bodies, notlookup()alone.
The live metadata plugins (e.g.
phlix-plugin-omdb) show the production arms of the same triad; the
developer guide
tours the contracts.
Dated caveat (2026-12-01) on that guide (
phlix-docs/docs/plugins/developer-guide.md): its tour of this template predates the current code in four places. (1) Its file-by-file tour and §10 still teach thedev-stubs/fallback pattern; those stubs were retired from this repo oncedetain/phlix-sharedbecame a hard Composer dependency (see AGENTS.md, "Known drift"). (2) Itscomposer.jsontour and pin advice say PHP>=8.1; this template requires>=8.3(Requirements below). (3) Its install example pastes a.../phlix-plugin-example/main/plugin.jsonraw URL —main/404s; this repo's only branch ismaster, so use themaster/form. (4) Its entry-class tour frameslookup()as the contract method, a framing that predates the triad: the live path is the triad above andlookup()is didactic. Where the guide and this README disagree, trust this README and the code; the correction lives with the guide's own repo (detain/phlix-docs).
Manifest type
This template declares "type": "metadata-provider" in plugin.json. The
value is validated and persisted by the host but never branches registration:
the interfaces the entry class implements decide what gets wired. The
plugin-manifest skill's Type→contract map section
(.claude/skills/plugin-manifest/SKILL.md)
maps all eleven schema types to their required interfaces and host registries,
with phlix-server line numbers as of 2026-12-01.
Install
The plugin is unsigned by design (signature: null) — the host logs a
warning and proceeds, because the trusted-key allowlist ships empty.
Install into a running Phlix server:
-
Log in as an admin user (
users.is_admin = 1). -
Open the admin Plugins section at
/app/admin/plugins(the legacy/admin/pluginspath redirects there). -
Use the Install from URL panel. The installer accepts three flavours: a repository URL (rewritten to its default-branch tarball by
SourceUrlResolver), a direct archive URL (*.zip,*.tar.gz,*.tgz), or a stubplugin.jsonwhosesourcefield points at such an archive.What works today:
-
Local archive (the procedure verified step by step when this fix landed): from one directory above your checkout, package it (a single root directory is flattened automatically):
tar czf /tmp/phlix-plugin-example.tar.gz \ --exclude='*/vendor' --exclude='*/.git' phlix-plugin-examplepaste
file:///tmp/phlix-plugin-example.tar.gz, or run the same install from the server's CLI (from thephlix-serverinstall directory):php bin/phlix plugin:install file:///tmp/phlix-plugin-example.tar.gz
file://sources are exempt from both the HTTPS-only gate and the pin requirement below — they are operator-local bytes. -
A remote archive that answers
200with no redirect (e.g. a self-hosted artifact download ending in.tar.gz/.zip), or a stubplugin.jsonwhosesourcenames one. Remote, un-pinned sources are refused by the loader's default-deny (SV-S2b — a review-ledger id for that finding):Refusing to install unverified plugin source …— unless the source matches a catalog entry carryingref+artifactSha256(this repo is listed in the officialdetain/phlix-pluginscatalog), or the operator setsPHLIX_PLUGINS_ALLOW_UNVERIFIED=1as an escape hatch (logs a warning). A catalog install click resolves to agithub.com/.../archive/...fetch, so the curated path rides the vetted hop described below on a host that carries it — the cure was cut for exactly that dev-channel install, and following GitHub's canonicalLocation(rather than rawcodeloadaliases) keeps the bytes equal to the catalog'sartifactSha256pins. On a host build without the hop the curated click still dies at the 302 refusal below. HTTPS-only applies unlessPHLIX_PLUGINS_ALLOW_HTTP=1(the admin endpoint stays HTTPS/file://-only regardless).
⚠ A GitHub URL paste completes only on a server build that carries the vetted-archive-hop cure — on
phlix-servermaster since 2026-11-05 (45922861). Everyhttps://github.com/OWNER/REPO/archive/…URL answers302, and the R20-02 SSRF gate (a review-ledger id) still refuses redirects before extraction — with exactly one vetted exception, checked as a pure header predicate (vettedGitHubArtifactRedirect) ahead of the refusal: a single 3xx whose loneLocationnameshttps://codeload.github.com/{same owner}/{same repo}/in thetar.gz/zipshape with a non-empty ref (no port, userinfo, query or fragment) is re-requested as one terminal leg under every other unchanged gate. A second redirect, a mismatched owner/repo, or any foreign redirect target is still refused byte-identically:HTTP redirects are not allowed (received HTTP/1.1 302 Found). No release tag carries the cure yet (newest at this writing,v1.2.3, predates it), so on a released host a GitHub paste still fails; derive the boundary the way Fork as a starter step 2 teaches —git describe --contains 45922861in aphlix-servercheckout names the first tag shipping the hop (until the next cut it errors, and that error is itself the answer: no released build has it). The recipe this README used to print — paste theraw.githubusercontent.com/.../main/plugin.jsonURL — fails twice over regardless of any cure: the branch ismaster(that URL 404s), and even corrected, this manifest has nosourcefield, so the stub arm throwsStub plugin.json must contain a "source" field pointing at a tarball or zip. -
-
The server downloads (or copies) the archive, validates the manifest with
Phlix\Plugins\Manifest\ManifestSchemaagainst the JSON Schema bundled indetain/phlix-shared, checksphlix_min_server_version, verifies any signature, runscomposer install --no-dev(with--no-scripts --no-plugins— the host's RCE kill-switch for install hooks), and stores a row in thepluginstable. The plugin lands disabled by default. -
Flip the toggle in the table to enable it.
The same operations are reachable via the JSON API —
POST /api/v1/admin/plugins/install with body {"url": "..."}, then
POST /api/v1/admin/plugins/{name}/enable; see
docs/plugins/install-from-url.md
for the curl recipes, and
docs/plugins/install-from-catalog.md
for the curated one-click path.
Use
On a live host, install and enable the plugin (see Install); the
loader configures it from the persisted settings and registers it as
the example metadata source, so search('hello') /
getDetails('hello') answer for movie items — with the operator's
greeting override applied.
The in-process demo below mirrors that host path, and
tests/HelloMetadataProviderTest.php pins it line for line
(test_readme_in_process_demo_holds) alongside behavioral tests for
the configure() absorb rule (missing, empty-string and non-string
greeting values keep the last good greeting) and the search() →
getDetails() pair. The block below is a complete PHP file — header
and autoloader included — so it runs as written from the repo root
once composer install has resolved detain/phlix-shared:
<?php require 'vendor/autoload.php'; $provider = new \Phlix\PluginExample\HelloMetadataProvider(); $provider->configure(['greeting' => 'Bonjour, Monde']); // the host's settings channel $provider->getDetails('hello'); // ['title' => 'Bonjour, Monde'] $provider->lookup('/test/hello.mkv'); // ['title' => 'Bonjour, Monde'] (didactic helper) $provider->lookup('/anything/else'); // []
The fixture path lives at
Phlix\PluginExample\HelloMetadataProvider::FIXTURE_PATH if you want
to reference it from tests.
Settings
plugin.json is the canonical source for the keys below — it carries
the declaration and the default the host seeds into its persisted
settings store at install (PluginLoader::defaultSettings() and
updateSettings() in phlix-server). The admin Plugins panel's
configure form edits the stored values
(PUT /api/v1/admin/plugins/{name}/settings), and the loader delivers
the store to the instance through configure() alone.
| Setting | Label | Type | Required | Default | Edit path | Description |
|---|---|---|---|---|---|---|
greeting |
Greeting | string | No | Hello, World |
admin Plugins panel → configure form | Title this metadata source returns for the demo fixture. Demonstrates the settings seam: the host delivers the persisted value through ConfigurableInterface::configure(). |
The Default cell is copied from plugin.json
(settings.greeting.default), and tests/ManifestContractTest.php
pins that default to the class's DEFAULT_GREETING constant — edit
plugin.json first and mirror the change here and in the constant.
An unusable stored greeting (a missing key, a non-string, or the
empty string) never aborts enabling: configure() keeps the last good
value and emits one error_log() line naming the setting key and the
received value's get_debug_type() — never the value itself, per the
logging rule under Settings & secrets — so a misconfigured store
is visible in the server log instead of presenting as a greeting that
silently refuses to change.
Settings & secrets
A real fork outgrows the demo quickly — usually by adding an upstream
API key (TMDB, TVDB, Fanart.tv, the classic metadata sources). The
configure() seam itself is demonstrated above (it is how the
greeting arrives); the network rules this template cannot
demonstrate are stated here instead of being left to each cloner's
improvisation:
- A secret has no place in the manifest.
plugin.jsonships in your public archive and is the bytes the installer fetches; adefaultcarrying a real key leaks it to every clone. Declare the key with"secret": trueand"default": null—required: trueis still fine: the host null-fills (see the Note in Fork as a starter step 2) — exactly the shapephlix-plugin-omdbuses for itsapi_key. "secret": trueis the blessed config seam. Only flagged keys are host-managed secrets: the admin API (GET /api/v1/admin/plugins/{name}) renders their stored values masked (***—Phlix\Plugins\SettingsMaskerserver-side), and the configure-form save keeps the stored secret when the UI round-trips the mask sentinel unchanged. A key declared without the flag round-trips visibly through admin surfaces — the flag, not the key's name, is what makes a setting a secret.- Read keys only through
configure().Phlix\Shared\Plugin\ConfigurableInterface::configure(array $settings)is, per the loader's own words, "the ONLY channel by which a plugin receives its configured API keys/options" (phlix-server/src/Plugins/PluginLoader.php). Stash it in a private property; never write the whole settings array — or any one secret value — into a log line. - Never let a raw secret reach an output surface, including
strings you return as
titleand URLs you print on failure. When the upstream demands the key in a query string, redact it on every log/exception surface —OmdbApi::MASKED_APIKEY+redactSecrets()inphlix-plugin-omdbare the reference.
Outbound calls
HelloMetadataProvider never touches the network; your replacement
probably will. The estate posture to copy (the estate: Phlix's family of official
detain/phlix-plugin-* repos) — demonstrated by the live metadata
plugins, not by this demo:
- https, with no runtime exception. The installer is HTTPS-only
(SV-S2b — see Install above); mirroring that gate in your own
calls costs nothing: pin an
https://base URL as a constant (OmdbApi::API_BASE). - Explicit timeout, TLS verification enabled. Use the HTTP client the
host runtime already carries —
Workerman\Http\Client, constructed with'timeout' => …(OmdbApi::HTTP_TIMEOUT_SECflows through as exactly that option) — and never silently disable certificate verification.phlix-plugin-omdbdefaults verification enabled and exposesuse_ssl_verificationas a deliberate advanced opt-out that logs a warning once when disabled; its HTTPS-only gate holds on every transport, including its bounded cURL backstop, either way. Never reach forfile_get_contents()or a raw socket without a timeout: a blocking call with no bound can stall the worker process your plugin shares with the host. - Bound your own retries.
OmdbApi::enforceRateLimit()shows a plugin staying inside its upstream's contract; retry storms are the plugin's problem, not the provider's burden. - Honour
Retry-Afteron 429 — with bounds both ways.phlix-plugin-anilist'sHttpClientobeys the header but raises short values to a floor (MIN_RETRY_AFTER_SEC = 1.0— a 429 that asks for a zero-delay retry must never produce one) and caps the automatic retries;phlix-plugin-myanimelistclamps the header toMAX_RETRY_AFTER_SEC = 300.0;phlix-plugin-lastfmclamps atMAX_RETRY_AFTER_SECONDS = 3600, because a literalRetry-After: 31536000would otherwise park a queued scrobble for a year. Trust the header's direction, clamp its magnitude. - Identify yourself: send a descriptive
User-Agent. Six plugins stamp one deliberately —phlix-plugin-traktsendsphlix/trakt (+https://github.com/detain/phlix-plugin-trakt)on every request,phlix-plugin-aniliststamps itsUSER_AGENTconstant likewise,phlix-plugin-myanimelistcarries the plugin version in it,phlix-plugin-opensubtitles' API terms require a contact identity in the UA,phlix-plugin-lastfmstamps the samephlix/<name> (+URL)idiom (its URL points at thephlix-serverrepo — a nit, but still a stamp), andphlix-plugin-musicbrainztreats it as config: aDEFAULT_USER_AGENTconstant surfaced as auser_agentplugin setting — MusicBrainz policy requires a descriptive contact UA — sanitised at the settings boundary before any request.phlix-plugin-omdbis the sole exception: it rides the vendor default — not the part to copy. An anonymous UA gets your plugin rate-limited or blocked on some other tenant's misbehaviour, with no way for the provider to reach you. - Defensive decoding must surface contract drift, not normalise it
to empty. When an upstream renames a field or reshapes its
envelope, a decoder that coerces the surprise into
[]hides the break forever: the host reads an empty result as a legitimate miss and moves on (PluginSourceConsultation.php:90/:100), so the outage never becomes visible.phlix-plugin-musicbrainz'sHttpResponsenames the cost of silence — it once droppedETagandRetry-Afterheaders, and it now classifies 429/503 explicitly as rate-limit ("the caller must back off"). Throw on a shape you did not contract for: the consult loop isolates a throwing source with one warning and consults the next one — loud is recoverable, silent-empty is not. - Keep "error" and "no match" distinct.
[]fromsearch()orgetDetails()means this provider has nothing for this item — the contract-legal empty map this demo itself returns. A transport failure, a 5xx, or rate-limit exhaustion means unknown, and it must reach the host as a throw:PluginSourceConsultation::consult()catches per source (full path cited under the call budget below), logs one warning, and lets the next source answer.phlix-plugin-lastfm'sLastfmOutcomeis the granular shape — transient failures (transport drops, 429, 5xx) are typed apart from terminal ones. Returning[]on error teaches the host your catalog is empty when the network is down. - Separate sandbox and production endpoints explicitly. Where an
upstream offers a sandbox host, name both base URLs as constants
(
https://, per the first bullet), switch only through an explicit setting, never fall back between them silently, and never send production credentials to a sandbox host or sandbox ones to production. No live estate plugin needs a sandbox today — this leg exists for the fork whose API has one. - Prefer header auth over query-string auth. When the upstream
accepts it, ride a header —
phlix-plugin-opensubtitlessendsAuthorization: Bearer <session token>, as do the OAuth plugins. A key in the query string leaks into every URL surface:phlix-plugin-omdb'sapikeyrides the query (http_build_queryinOmdbApi), and that is precisely why it must shipMASKED_APIKEY+redactSecrets()to scrub the key out of every log line and exception. If your API allows only query keys, copy omdb's redaction discipline before writing the firsthttp_build_query. workerman/http-clientbelongs inrequire-dev, notrequire. The host runtime already carries Workerman, so the client is a build-time symbol, not a shipped dependency:phlix-plugin-omdbandphlix-plugin-lastfmdeclareworkerman/http-clientunderrequire-dev(omdb also declaresworkerman/workermanthere; lastfm does not) — that is what letscomposer phpstan(level 9 oversrc/, as in this repo'sphpstan.neon) resolveWorkerman\Http\Clientwithout your plugin shipping its own copy of the host's event loop.
The call budget — the host calls you per item, per source, on live
paths. One search() plus one getDetails() is the minimum per
source: PluginSourceConsultation::consult()
(phlix-server/src/Media/Metadata/Resolution/PluginSourceConsultation.php:82-115)
walks orderedSources() (:133-150), which runs the
metadata.provider_priority list first and then continues through
every remaining registered source of the item's media type.
Those consults ride the resolution and match paths —
MovieMetadataResolver/SeriesMetadataResolver, the once-per-item
PluginMetadataEnricher, and matching driven from the HTTP
controllers — so a browser action can fan out behind you. Your real
budget is therefore items × sources × calls-per-source, and the
only cushion is MetadataManager's hasRecentMetadata() freshness
gate (src/Media/Metadata/MetadataManager.php:461, :628 —
metadata.cache_ttl_hours, shipped default 24 hours) — and a forced
refresh ($force) bypasses even that. Budget every upstream call
like a rate-limited API must survive a whole-library pass, not just
one detail page.
Events
The host dispatches PSR-14 events (psr/event-dispatcher; in
phlix-server, Phlix\Common\Events\ListenerRegistry is the
subscribe facade and EventDispatcherFactory builds the dispatcher
from it). The producers are real runtime moments: playback
transitions (src/Session/PlaybackController.php:857 dispatches
PlaybackStarted, :881/:905/:950 the pause/resume/stop
counterparts), library scans
(src/Media/Library/MediaScanner.php:3567 LibraryScanStarted,
:3621 MediaItemAdded), and user sessions (src/Auth/AuthManager.php:2807
UserLoggedIn). The shared event classes ride three manifest alias
families — phlix.playback.*, phlix.library.*, phlix.user.* —
translated by Phlix\Shared\Plugin\EventNameMap in
detain/phlix-shared.
A provider subscribes through the lifecycle contract: the loader
calls subscribedEvents() once onEnable() has returned, and
attaches every event FQCN => handler pair to the registry, where a
handler is either a method name on the entry instance (the loader
binds it as [$instance, $method] — PluginLoader::resolveCallable)
or any PHP callable. The one line a listening fork would add:
public function subscribedEvents(): array { return [\Phlix\Shared\Events\Library\MediaItemAdded::class => 'onMediaItemAdded']; }
This reference class subscribes to none — deliberately.
subscribedEvents() returns [] (pinned by
test_subscribed_events_is_empty) and plugin.json declares
events: [] to match; tests/ManifestContractTest.php pins the two
sets equal, so an entry class that starts listening without updating
its manifest reddens the build. The reason the reference can stay
silent is that a metadata provider never needs the dispatcher to be
reached: the host consults the triad by direct call
(PluginSourceConsultation — see The call budget above), and no
event is required to answer one. Listeners are for the moments the
triad cannot see — invalidating your own caches on
phlix.library.item.updated, mirroring session state on
phlix.user.* — and the fail-fast law tying manifest aliases to
subscribedEvents() is stated under Fork as a starter step 2.
Fork as a starter
This repository is intentionally small (one PHP class, three test files plus a bootstrap) so you can copy it as the seed for your own plugin:
-
Fork or
git clonethis repo, then rename the new directory. -
Edit
plugin.json— pick a newname(must start withphlix-plugin-), setversion, changeentryto your FQCN, and setphlix_min_server_versionto an honest floor: the oldest Phlix server release that carries every feature your code relies on. Derive it from the server's history instead of guessing — in a checkout ofphlix-server, rungit describe --contains <feature-sha>for the commit that introduced each seam you use, and keep the oldest tag any of them returns. This template's own two load-bearing seams — typed metadata-source registration throughSourceRegistry(63c5666a) and settings delivery on enable viaConfigurableInterface::configure()(de6ce093) — both land insidev1.2.0, which is why this repo declares1.2.0(the same floor its sibling reference pluginsphlix-plugin-anilistandphlix-plugin-traktpin). Do not conflate that with the shared-pin era: thedetain/phlix-sharedconstraint incomposer.json(here^0.59.0) covers the build-time contracts —MetadataSourceInterfaceexists in shared since v0.15.0 andConfigurableInterfacesince v0.18.0, both well inside^0.59.0— whilephlix_min_server_versionspeaks about the running server: a plugin compiled against a recent shared may only claim an older floor if the server-side seams it calls were actually shipped there. Theeventsaliases you may declare there are validation metadata: the host's fail-fast check validates each alias againstPhlix\Shared\Plugin\EventNameMap's real families (phlix.playback.*,phlix.library.*,phlix.user.*— there is nophlix.auth.*family); what actually subscribes your listeners is your entry class'ssubscribedEvents(). The manifest schema is the JSON Schema bundled indetain/phlix-shared/schemas/manifest.schema.json; the key-by-key guide isdocs/plugins/manifest.md.Note: If you declare a setting
required:true, give it adefaultor the host will null-fill it — seedocs/plugins/manifest.md. Settings only ever reach your instance throughConfigurableInterface::configure(). -
Edit
composer.json— rename the package, change the PSR-4 prefix underautoload.psr-4. Therepositoriesentry (avcssource fordetain/phlix-shared) exists only because that package is fetched from GitHub; drop it, or replace it with your own source, once you resolvephlix-sharedfrom Packagist. -
Rewrite
src/HelloMetadataProvider.phpwith your own implementation, keepingonEnable()cheap and doing the heavy work behind the contract methods. That heavy work must be loop-safe: the host calls those contract methods per item, per source, on the request path — see the call budget under Outbound calls — so budget every upstream call like it fires inside a scan you do not control. The reference class already implements the interfaces your manifesttypeis consulted through (metadata providers:MetadataSourceInterface, settings viaConfigurableInterface) — keep the interfaces and replace their bodies with real upstream calls. The didacticlookup()helper is the one piece you may drop: the host never calls it, so a fork that keeps only that shape installs and enables but is never consulted. Edit theSOURCE_NAMEconstant ('example') alongside any class rename:sourceName()returns it, and it is the slug the host keys your source on inmetadata.provider_priority. If the new class needs an API key or calls an upstream service, follow Settings & secrets and Outbound calls above — do not improvise key handling. -
Replace the tests in
tests/to match — but keeptests/SecurityAuditCheckTest.php,scripts/security-audit-check.phpand thecomposer-auditjob in.github/workflows/test.yml. Those three are the estate's whole-lock audit gate, and the guard test reddens your build if you neuter it. Two fork chores ride with it:- Re-measure your own
composer.lockand re-pin both floors inscripts/security-audit-check.php(MIN_AUDITED_PACKAGESandMIN_AUDITED_DEV_PACKAGES), updating the guard test's restated copies (MIN_PACKAGES/MIN_DEV_PACKAGESintests/SecurityAuditCheckTest.php) in the same commit — the values here are measured on this repo's lock, andtestFloorsMatchTheScript()reddens when the two copies disagree. - Delete
scripts/add-headers.php, or re-parameterize its@copyrightline with your own name before running it — as shipped it stamps this repo's author onto every file.
- Re-measure your own
-
Publish so the install flow can fetch you: a direct-200 archive URL (or a stub
plugin.jsoncarrying asourcefield that names one), plus a catalog pin for remote sources — the loader's default-deny applies to every remote fetch regardless. On a server build that carries the vetted hop (Install above), a plain GitHub archive URL paste also installs, which covers dev-channel testing against your own repo.
The plugin developer guide has the full walkthrough, including the lifecycle diagram and the manifest event alias table:
docs/plugins/developer-guide.mddocs/plugins/manifest.mddocs/plugins/install-from-url.mddocs/plugins/trusted-plugin-list.md
The dated caveat under What it does (2026-12-01) names the four places where the developer-guide tour above lags this template.
Requirements
- PHP >= 8.3 — the only declared source of the floor is
composer.json("php": ">=8.3"); CI exercises both 8.3 and 8.4 (.github/workflows/test.yml, thephpunitjob matrixphp). - Composer — pulls the build-time contracts
(
detain/phlix-shared) and the gate tooling (PHPUnit, PHPStan, PHPCS) that the section below runs. - A running Phlix server — needed only to install and enable
the plugin (see Install);
vendor/bin/phpunitruns against the contracts alone, with no host process involved.
Running the tests locally
composer install
vendor/bin/phpunit
composer phpstan
composer phpcs
php scripts/security-audit-check.php # same security gate CI runs
License
MIT — see LICENSE.