nehalvpatel/gfycat-php

PHP接口,用于访问Gfycat API。

2.0.0 2015-09-02 05:18 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:11:20 UTC


README

PHP接口,用于访问Gfycat API。

安装

将包添加到您的composer文件中

composer require nehalvpatel/gfycat-php "^2.0"
composer update

示例

  require 'vendor/autoload.php';
  
  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"));

贡献

在创建pull request之前运行测试:vendor/bin/phpunit