PHP code example of hiddeco / laravel-giphy

1. Go to this page and download the library: Download hiddeco/laravel-giphy 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/ */

    

hiddeco / laravel-giphy example snippets




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();
		}
    }
}

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

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

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

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

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

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

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

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

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

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