composer require mattyrad/noun-project-php-client
Pass a NounProject\Request
to the NounProject\Client
to receive data from the API. You will receive a MattyRad\Support\Result
back.
use MattyRad\NounProject;
$api = new NounProject\Client($key = 'abc123', $secret= 'xxxx');
$result = $api->send(new NounProject\Request\Icons($term = 'feather', $public_domain = true));
if (! $result->isSuccess()) {
throw new \Exception($result->getReason());
}
$icons = $result->getIcons();
$result = $api->send(new NounProject\Request\Collection($collection_id_or_slug = 123));
$collection = $result->getCollection();
$result = $api->send(new NounProject\Request\IconsInCollection(
$collection_id_or_slug = 123,
$offset = 1,
$page = 2,
$limit = 3
));
$icons = $result->getIcons();
$result = $api->send(new NounProject\Request\Collections($offset = 2, $page = 3, $limit = 1000));
$collections = $result->getCollections();
$result = $api->send(new NounProject\Request\Icon($icon_id_or_term = 123));
$icon = $result->getIcon();
$result = $api->send(new NounProject\Request\Icons(
$icon_id_or_term = 'feather'
$limit_to_public_domain = true;
$offset = 2;
$page = 3;
$limit = 4;
));
$icon = $result->getIcons();
$result = $api->send(new NounProject\Request\RecentIcons);
$icon = $result->getIcons();
$result = $api->send(new NounProject\Request\Usage);
$usage = $result->getUsage();
$limits = $result->getLimits();