detain / phlix-plugin-omdb
OMDb metadata provider for Phlix — IMDb and Rotten Tomatoes ratings for movies and TV.
Package info
github.com/detain/phlix-plugin-omdb
Type:phlix-plugin
pkg:composer/detain/phlix-plugin-omdb
Requires
- php: >=8.3
- detain/phlix-shared: ^0.21.0
- psr/container: ^1.1 || ^2.0
- psr/log: ^1.0 || ^2.0 || ^3.0
Requires (Dev)
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^4.0
- workerman/http-client: ^1.0
- workerman/workerman: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-03 10:52:24 UTC
README
OMDb metadata provider for Phlix — IMDb and Rotten Tomatoes ratings for movies and TV.
Queries the OMDb API to enrich Phlix media items with
IMDb ID and IMDb / Rotten Tomatoes ratings. Ratings are returned under the valid
metadata_ratings.source ENUM values (imdb, rt); OMDb's Metacritic rating is
read but deliberately dropped — the ENUM has no member for it. The host resolver
owns writing ratings and Phlix's rating aggregation.
Features
- IMDb ID resolution — search by title (with an optional release-year hint) to resolve the canonical IMDb ID. OMDb paginates its search results and this plugin reads page 1 only, so the returned list is a first-page shortlist (~10-20 entries), not the complete match set — a common title can have many more matches upstream
- Multi-source ratings — captures IMDb and Rotten Tomatoes scores
- Blocking-cURL posture on the production host (registered exception) —
HTTPS-only throughout. The async Workerman/http-client arm only completes
on the Fiber/Revolt event loop; the Phlix host runs the Swoole adapter,
where async TLS reads stall after the handshake, so every cache-miss
lookup there takes a bounded blocking
curl_execinstead. That is the ratified posture, not a fallback edge: the host registers it as Exception 10 — "OMDb plugin https lookups routed to blocking cURL" indocs/dev/BLOCKING_IO_EXCEPTIONS.mdof phlix-server (registered 2026-11-12, OMB-6). The stall is bounded by the 10 s request timeout on a quota-paced enrichment call — a request that can never complete is the alternative being avoided - Rate limiting — fixed minimum spacing between calls (0.25s), plus an automatic pause until the next UTC midnight once OMDb reports that your API key has used up its daily request allowance; the interval is not a setting. Note the pacing is per-instance and best-effort: each client instance paces only its own dispatches, so N worker processes — and any script using the same key out-of-band — share one daily budget without coordination. Treat the 0.25s spacing as burst protection within a single instance, not quota enforcement across the key. A cross-instance host pacer (
SourceRateLimiter, ~90s spacing for omdb) exists only in unreleased phlix-server code — no released server tag carries it, so until your host runs a belt-carrying release, this plugin's own cooldown is the only daily-budget guard - Response caching — configurable in-memory cache TTL to reduce API calls (
0disables the cache; capped at 30 days) - TLS verification toggle — advanced escape hatch that disables certificate checking. OMDb authenticates with your key in the URL query string, so unverified TLS lets an intercepting hop harvest the API key. Keep it on; use off only when debugging behind a proxy you control
- Pure read —
getDetails()fetches and shapes data only;onEnable()does no network or DB I/O and never throws on a missing key
Install
The plugin is unsigned by design — install via the Phlix admin UI:
-
Log in to your Phlix server as an admin user (
users.is_admin = 1). -
Browse to
/admin/plugins. -
Paste this URL into the Install from URL form and submit:
https://raw.githubusercontent.com/detain/phlix-plugin-omdb/master/plugin.json -
The server downloads the manifest, validates it, runs
composer install --no-dev, and stores a row in thepluginstable. The plugin lands disabled by default. -
Enter your OMDb API key in the plugin settings (get one at OMDb API).
-
Turn the Enable OMDb lookups (
enabled) setting on in the same dialog. It is a second, separate switch and it defaults to off: while it is off the plugin performs no lookups at all, even with a valid API key saved. -
Flip the toggle in the table to enable it.
Runtime dependencies (host-provided)
workerman/workerman and workerman/http-client are host-provided at
runtime: the Phlix server's worker already loads them, and the plugin
resolves those classes from the host autoloader. They are listed under
require-dev by design — not an oversight — so the host's pinned generations
stay authoritative; see the [M-OMDB-13] library-generation contract in
src/OmdbApi.php (tested against this repo's lock generation, run against the
host's). Do not move them to require: the sibling metadata plugins keep
them dev-only, and aligning the lock with the host generation is an
owner-gated change.
Consequence: because the install above runs composer install --no-dev, the
plugin's own vendor tree ships no HTTP client — that is expected inside a
Phlix host. A standalone --no-dev copy of this package outside a Phlix
host cannot run: the async transport it needs is supplied by the host, not
by its own install. For local development and tests, run a full
composer install (dev dependencies included) as shown in
Running tests locally.
Settings
plugin.json is the canonical source for these settings; each label and
description below is copied from it verbatim, so edit plugin.json first and
mirror the change here.
| Setting | Label | Type | Required | Secret | Tier | Default | Description |
|---|---|---|---|---|---|---|---|
enabled |
Enable OMDb lookups | boolean | No | No | standard |
false |
Master on/off for OMDb enrichment. Optional; default off. |
api_key |
OMDb API key | string | Yes | Yes | standard |
null |
Your OMDb API key. The free tier allows 1,000 requests/day. |
use_ssl_verification |
Verify TLS certificate | boolean | No | No | advanced |
true |
Verify the TLS certificate presented by OMDb. Keep this on. Turning it off lets any intercepting hop read and tamper with the traffic — including your API key, which the plugin sends to OMDb in the URL query string and which could be stolen. Use off only when debugging behind a proxy you control. |
cache_ttl_seconds |
Cache TTL (seconds) | integer | No | No | advanced |
86400 |
How long to cache OMDb responses; 0 disables the cache. Values above 2,592,000 (30 days) are lowered to 2,592,000, and negative values disable the cache. Optional; default 86400 (24 hours). |
Where to get your OMDb API key
The api_key setting is required. Request a free key at
https://www.omdbapi.com/apikey.aspx — the free tier allows 1,000 requests/day.
What it does
When enabled, the plugin registers as a MetadataSourceInterface provider. When
the Phlix metadata manager requests details for a media item:
- The plugin receives the search query (title + optional year hint)
- It queries OMDb's search endpoint to find matching entries — the year is
sent as
y=, but OMDb only documents it as a disambiguator for the single-title (t=) lookup, so search results are not guaranteed to be year-filtered; every returned row carries itsyear(andtype) alongside theidandtitle, so callers that need a strict filter match against it - It fetches full details including ratings for the selected IMDb ID
- Ratings are returned as a
ratingslist using themetadata_ratings.sourceENUM values (imdb,rt) for the host resolver to persist and aggregate
Supported media types
movieseries
Running tests locally
composer install vendor/bin/phpunit vendor/bin/phpstan analyse src --level=9 vendor/bin/phpcs src --standard=PSR12 php scripts/security-audit-check.php
The composer-audit job in .github/workflows/test.yml runs
php scripts/security-audit-check.php, which audits the whole composer.lock
(require and require-dev) and fails the job on any security advisory; see
the script header for the full blocking policy.
Data attribution and terms
OMDb data is provided by omdbapi.com under CC BY-NC 4.0.
Per the OMDb terms of use, the metadata this plugin fetches (IMDb IDs and IMDb / Rotten Tomatoes ratings) is licensed Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0):
- Attribution — OMDb-sourced content must carry the notice above.
- Non-commercial — CC BY-NC 4.0 permits only non-commercial use of OMDb data. Running a Phlix deployment that charges for access to, or otherwise commercially exploits, OMDb-sourced ratings is outside the license unless you have cleared separate commercial terms with OMDb. This plugin ships the disclosure; the commercial-use decision belongs to the operator.
- Scope — the CC BY-NC 4.0 term applies to the OMDb data, not to this repository's code, which remains MIT-licensed (see below).
License
MIT — see LICENSE — for this plugin's code. OMDb data accessed
through it is provided by omdbapi.com under CC BY-NC 4.0 (non-commercial);
see Data attribution and terms above.