-
Notifications
You must be signed in to change notification settings - Fork 2
Isbn
Pieter Hordijk edited this page Dec 31, 2018
·
2 revisions
Validates the input (string) to be an existing ISBN number.
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\Isbn\Exists;
$httpClient = new ArtaxClient(new DefaultClient(), new Redis(new Client('tcp://127.0.0.1:6379')));
(new Exists($httpClient, 'google books api key'))->validate('9788970137506');Note: The ISBN results are cached for 7 days.
-
Type.Stringwhen the validated value is not a string -
Isbn.Isbnwhen the validated value is not a valid ISBN number -
Isbn.Existswhen the ISBN number does not exists
Validates the input (string) to be a valid ISBN number.
Available since: 1.0.0
<?php declare(strict_types);
use HarmonyIO\Validation\Rule\Isbn\Isbn;
(new Isbn())->validate('9788970137506');-
Type.Stringwhen the validated value is not a string -
Isbn.Isbnwhen the validated value is not a valid ISBN number
Validates the input (string) to be a valid ISBN-10 number.
Available since: 1.0.0
<?php declare(strict_types);
use HarmonyIO\Validation\Rule\Isbn\Isbn10;
(new Isbn10())->validate('1566199093');-
Type.Stringwhen the validated value is not a string -
Isbn.Isbn10when the validated value is not a valid ISBN-10 number
Validates the input (string) to be a valid ISBN-13 number.
Available since: 1.0.0
<?php declare(strict_types);
use HarmonyIO\Validation\Rule\Isbn\Isbn13;
(new Isbn13())->validate('9788970137506');-
Type.Stringwhen the validated value is not a string -
Isbn.Isbn13when the validated value is not a valid ISBN-13 number