baraja-core / video-token
Parse video token from user string or URL.
Installs: 5 706
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
Requires (Dev)
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.0
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-nette: ^1.0
- phpstan/phpstan-strict-rules: ^1.0
- roave/security-advisories: dev-master
- spaze/phpstan-disallowed-calls: ^2.0
This package is auto-updated.
Last update: 2024-11-30 01:47:14 UTC
README
Parse video token from user string or URL.
How to use
Detect token from URL:
$token = new \Baraja\VideoToken\VideoToken( 'https://www.youtube.com/watch?v=_Gi_LQ0a8EA' ); // or $token = new \Baraja\VideoToken\VideoToken('_Gi_LQ0a8EA', 'youtube'); echo $token->getToken(); // _Gi_LQ0a8EA echo $token->getProvider(); // youtube echo $token->getThumbnailUrl(); // https://img.youtube.com/vi/_Gi_LQ0a8EA/maxresdefault.jpg echo $token->getUrl(); // https://www.youtube.com/embed/_Gi_LQ0a8EA?rel=0
The input can be a URL from one of the supported video platforms, or a token
and provider
. The validity of the passed token will be automatically verified.
The operation of getting a preview image can be performance intensive, so always cache the result of the call.