giphy/giphy-php-client

1.0.0 2017-09-27 21:06 UTC

This package is not auto-updated.

Last update: 2024-09-18 22:15:57 UTC


README

Giphy 核心SDK 是 Giphy API 的封装。

Build Status

Giphy 是在互联网上搜索、分享和发现GIF的最佳方式。类似于其他搜索引擎的工作方式,我们的大部分内容来自对网络上最好和最受欢迎的GIF和搜索词的索引。我们组织了所有这些GIF,以便您可以更容易地找到优质内容并通过您的社交渠道分享它。我们还介绍了一些我们最喜欢的GIF艺术家,并与品牌合作创建和推广他们原创的GIF内容。

入门

要求

PHP 5.4.0 及以上版本

安装与使用

安装

composer require giphy/giphy-php-client

使用

    require_once('/path/to/GiphyClient/autoload.php');

入门

请遵循安装流程,然后运行以下命令

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new GPH\Api\DefaultApi();
$api_key = "dc6zaTOxFJmzC"; // string | Giphy API Key.
$q = "cheeseburgers"; // string | Search query term or prhase.
$limit = 25; // int | The maximum number of records to return.
$offset = 0; // int | An optional results offset. Defaults to 0.
$rating = "g"; // string | Filters results by specified rating.
$lang = "en"; // string | Specify default country for regional content; use a 2-letter ISO 639-1 country code. See list of supported languages <a href = \"../language-support\">here</a>.
$fmt = "json"; // string | Used to indicate the expected response format. Default is Json.

try {
    $result = $api_instance->gifsSearchGet($api_key, $q, $limit, $offset, $rating, $lang, $fmt);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->gifsSearchGet: ', $e->getMessage(), PHP_EOL;
}
?>

API端点文档

所有URI相对于 http://api.giphy.com/v1

模型文档