Git Product home page Git Product logo

noun-project-php-client's Introduction

The Noun Project PHP Client

Build Status Code Coverage

Installation

composer require rolfisub/noun-project-php-client

Usage

Pass a NounProject\Request to the NounProject\Client to receive data from the API. You will receive a MattyRad\Support\Result back.

Example

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();

API and Requests Types

Collection

Returns a single collection (by collection id or slug)
$result = $api->send(new NounProject\Request\Collection($collection_id_or_slug = 123));

$collection = $result->getCollection();
Returns a list of icons associated with a collection (by collection id or slug)
$result = $api->send(new NounProject\Request\IconsInCollection(
    $collection_id_or_slug = 123,
    $offset = 1,
    $page = 2,
    $limit = 3
));

$icons = $result->getIcons();

Collections

Return’s a list of all collections
$result = $api->send(new NounProject\Request\Collections($offset = 2, $page = 3, $limit = 1000));

$collections = $result->getCollections();

Icon

Returns a single icon
$result = $api->send(new NounProject\Request\Icon($icon_id_or_term = 123));

$icon = $result->getIcon();

Icons

Returns a list of icons
$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();
Returns list of most recently uploaded icons
$result = $api->send(new NounProject\Request\RecentIcons);

$icon = $result->getIcons();

Usage

Returns current oauth usage and limits
$result = $api->send(new NounProject\Request\Usage);

$usage = $result->getUsage();
$limits = $result->getLimits();

Publish

Notifies the api about published icons Id's
$result = $api->send(new NounProject\Request\Publish("1,2");

$published = $result->getPublished();

if($published["result"] === "success") {
    echo "Yay!";
}

User

TODO

noun-project-php-client's People

Contributors

mattyrad avatar tpconway5985 avatar rolfisub avatar jimbolino avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.