-
Notifications
You must be signed in to change notification settings - Fork 2
VideoService
Pieter Hordijk edited this page Jan 1, 2019
·
1 revision
Validates the input (string
) to be a valid YouTube video id.
Available since: 1.0.0
<?php declare(strict_types);
use Amp\Artax\DefaultClient;
use Amp\Redis\Client;
use HarmonyIO\Cache\Provider\Redis;
use HarmonyIO\HttpClient\Client\ArtaxClient;
use HarmonyIO\Validation\Rule\VideoService\YouTube\VideoId;
$httpClient = new ArtaxClient(new DefaultClient(), new Redis(new Client('tcp://127.0.0.1:6379')));
(new VideoId($httpClient))->validate('kfVsfOSbJY0');
Note: the results are cached for 1 hour.
-
Type.String
when the validated value is not a string -
VideoService.YouTube.VideoId
when the validated value is not a valid YouTube video id
Validates the input (string
) to be a valid YouTube video URL.
Available since: 1.0.0
<?php declare(strict_types);
use Amp\Artax\DefaultClient;
use Amp\Redis\Client;
use HarmonyIO\Cache\Provider\Redis;
use HarmonyIO\HttpClient\Client\ArtaxClient;
use HarmonyIO\Validation\Rule\VideoService\YouTube\VideoUrl;
$httpClient = new ArtaxClient(new DefaultClient(), new Redis(new Client('tcp://127.0.0.1:6379')));
(new VideoUrl($httpClient))->validate('https://www.youtube.com/watch?v=kfVsfOSbJY0');
Note: the results are cached for 1 hour.
-
Type.String
when the validated value is not a string -
VideoService.YouTube.VideoUrl
when the validated value is not a valid YouTube video URL