PHP code example of giphy / giphy-php-client

1. Go to this page and download the library: Download giphy/giphy-php-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

giphy / giphy-php-client example snippets


    


_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;
}
bash
composer