2017 © Pedro Peláez
 

library laravel-giphy

Giphy API wrapper for Laravel and Lumen based on Guzzle

image

hiddeco/laravel-giphy

Giphy API wrapper for Laravel and Lumen based on Guzzle

  • Monday, February 29, 2016
  • by hiddeco
  • Repository
  • 0 Watchers
  • 25 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel Giphy

LARAVEL GIPHY, (*1)

Laravel Giphy is a Giphy API wrapper for Laravel (and Lumen but ssh, don't tell anyone), providing an easy to access Giphy facade., (*2)

Installation

To use this package without running in to trouble you will need PHP 5.5+ or HHVM 3.6+, and Composer., (*3)

  1. Get the latest version of Laravel Giphy, add the following line to your composer.json file, (*4)

    "hiddeco/laravel-giphy": "0.1.*@alpha", (*5)

  2. Run composer update or composer install, (*6)

  3. Register the Laravel Giphy service provider in config/app.php by adding 'HiddeCo\Giphy\GiphyServiceProvider to the providers key, (*7)

  4. Add the Giphy facade to the aliases key: 'Giphy' => 'HiddeCo\Giphy\Facades\Giphy', (*8)

Configuration

The only configuration Laravel Giphy needs is a GIPHY_API_KEY in your .env file. A public beta key is available in the Giphy API Documentation., (*9)

Note: On Laravel it is also possible to configure Laravel Giphy by running php artisan config:publish and adding your apiKey to config/giphy.php., (*10)

Injecting Giphy

Injecting Giphy in to a controller could not have been any easier., (*11)

<?php

class GifController extends BaseController {

    public function __construct(HiddeCo\Giphy\Giphy $giphy)
    {

        $this->giphy = $giphy;

    }

    public function get($id)
    {
        try
        {

            return $this->giphy->gif()->random([ 'fmt' => 'html' ]);
        }
        catch (\Exception $e)
        {

            return $e->getMessage();
        }
    }
}

The API

Using this package to communicate with the Giphy API is fairly simple by using the Giphy facade., (*12)

Giphy: GIFs

Do you want to find a sweet GIF based on a keyword, translate a keyword to just one GIF or just get a random GIF? It is all possible., (*13)

Giphy::gif->search($query, $params = [])

Searches all GIFs for the provided word or phrase and accepts 4 optional parameters as array. - limit: default 25 (max: 100) - offset - rating: limit results by rating (y,g, pg, pg-13 or r) - fmt: returned format, json or html (default: json), (*14)

Giphy::gif()->search('code', ['limit' => 10, 'offset' => 10, 'rating' => 'g', 'fmt' => 'html']);

Gipgy::gif()->get($id)

Returns JSON meta data about a GIF by id., (*15)

Giphy::gif()->get('4hnQDVKVARZ6w');

Giphy::gif()->getMultiple($ids = [])

Returns JSON meta data about mulitple GIFs by id., (*16)

Giphy::gif()->getMultiple(['4hnQDVKVARZ6w', 'Ro2MgOxH9iaVG']);

Giphy::gif()->translate($query, $params = [])

Returns a GIF from the Giphy 'translation engine', enter a keyword and get a GIF translation back. Accepts 2 optional parameters. - rating: limit results by rating (y,g, pg, pg-13 or r) - fmt: returned format, json or html (default: json), (*17)

Giphy::gif()->translate($query, ['rating' => 'g', 'fmt' => 'html']);

Giphy::gif()->random($params = [])

Returns a random GIF, limitation is possible by using the following optional parameters. - tag: get a random GIF based on the keyword - rating: limit results by rating (y,g, pg, pg-13 or r) - fmt: returned format, json or html (default: json), (*18)

Giphy::gif()->random(['tag' => 'cats', 'rating' => 'g', 'fmt' => 'html']);

Giphy::gif()->trending($params = [])

Returns currently trending GIFs on the internet. Accepts 3 optional parameters. - limit: default 25 (max: 100) - rating: limit results by rating (y,g, pg, pg-13 or r) - fmt: returned format, json or html (default: json), (*19)

Giphy::gif()->trending(['limit' => 100, 'rating' => 'pg', 'fmt' => 'html');

Giphy: Stickers

Giphy stickers are animated stickers (animated GIFs with transparent backgrounds)., (*20)

Giphy::sticker()->search($query, $params = [])

Searches all sticker GIFs for the provided word or phrase and accepts 4 optional parameters as array. - limit: default 25 (max: 100) - offset - rating: limit results by rating (y,g, pg, pg-13 or r) - fmt: returned format, json or html (default: json), (*21)

Giphy::sticker()->search('code', ['limit' => 10, 'offset' => 10, 'rating' => 'g', 'fmt' => 'html']);

Giphy::sticker()->translate($query, $params = [])

Returns a sticker GIF from the Giphy 'translation engine', enter a keyword and get a sticker GIF translation back. Accepts 2 optional parameters. - rating: limit results by rating (y,g, pg, pg-13 or r) - fmt: returned format, json or html (default: json), (*22)

Giphy::sticker()->translate($query, ['rating' => 'g', 'fmt' => 'html']);

Giphy::sticker()->random($params = [])

Returns a random sticker GIF, limitation is possible by using the following optional parameters. - tag: get a random GIF based on the keyword - rating: limit results by rating (y,g, pg, pg-13 or r) - fmt: returned format, json or html (default: json), (*23)

Giphy::sticker()->random(['tag' => 'cats', 'rating' => 'g', 'fmt' => 'html]);

Giphy::sticker()->trending($params = [])

Returns currently trending sticker GIFs on the internet. Accepts 3 optional parameters. - limit: default 25 (max: 100) - rating: limit results by rating (y,g, pg, pg-13 or r) - fmt: returned format, json or html (default: json), (*24)

Giphy::sticker()->trending(['limit' => 100, 'rating' => 'pg', 'fmt' => 'html']);

License

Laravel Giphy is licensed under the MIT License (MIT)., (*25)

The Versions

29/02 2016

dev-master

9999999-dev

Giphy API wrapper for Laravel and Lumen based on Guzzle

  Sources   Download

MIT

The Requires

 

laravel api giphy

28/06 2015

v0.1.0-alpha

0.1.0.0-alpha

Giphy API wrapper for Laravel and Lumen based on Guzzle

  Sources   Download

MIT

The Requires

 

laravel api giphy