colonizator1/tv-detector

Lightweight TV user-agent detector.

Maintainers

Package info

github.com/Colonizator1/tv-detector

pkg:composer/colonizator1/tv-detector

Statistics

Installs: 58

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.3 2026-04-15 09:53 UTC

This package is auto-updated.

Last update: 2026-04-15 09:54:59 UTC


README

Lightweight TV user-agent detector extracted from matomo/device-detector brand-level regexes. Uses a single preg_match() instead of the full DeviceDetector pipeline.

Installation

composer require colonizator1/tv-detector

Usage

<?php
require __DIR__ . '/vendor/autoload.php';

use TvDetector\TvDetector;

$userAgent = $_SERVER['HTTP_USER_AGENT'] ?? '';

if (TvDetector::isAndroidTV($userAgent)) {
    // Handle Android TV specifics
}

if (TvDetector::isTV($userAgent)) {
    // Handle generic TV
}

API

  • TvDetector::isTV(string $userAgent): bool — returns true if the user agent matches any known TV signatures.
  • TvDetector::isAndroidTV(string $userAgent): bool — returns true if the user agent looks like Android TV (including OEM skins).

Notes

  • Patterns are derived from the Matomo DeviceDetector regex sets (televisions and shell TV), limited to brand-level detection.
  • Empty user agents return false.

License

MIT