PHP code example of nehalvpatel / gfycat-php

1. Go to this page and download the library: Download nehalvpatel/gfycat-php 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/ */

    

nehalvpatel / gfycat-php example snippets


   
  use nehalvpatel\Gfycat;
  
  // convert a gif from a Url
  print_r(Gfycat::convertUrl("http://i.imgur.com/gTv0isU.gif"));
  
  // convert a gif from a Url and release (async upload, check status using query())
  Gfycat::convertUrlAndRelease("http://i.imgur.com/gTv0isU.gif");
  //// -> returns gfycat key if gif hasn't already been uploaded to gfycat
  //// -> returns array of gfy data if the gif has been converted before
  
  // convert a gif from a file
  $file = // stream of data (fopen() or an instance of a Psr\Http\Message\StreamInterface)
  print_r(Gfycat::convertFile($file);
  
  // query a gfy name for urls and more information
  print_r(Gfycat::query("SpryFixedGnu"));
  
  // check if a URL has already been converted
  print_r(Gfycat::check("http://i.imgur.com/gTv0isU.gif"));