PHPackages                             rfreebern/giphy-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. rfreebern/giphy-php

ActiveLibrary[API Development](/categories/api)

rfreebern/giphy-php
===================

A library implementing access to the Giphy API.

893.0k—9.5%1PHP

Since Mar 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/rfreebern/giphy-php)[ Packagist](https://packagist.org/packages/rfreebern/giphy-php)[ RSS](/packages/rfreebern-giphy-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP interface to the Giphy API
==============================

[](#php-interface-to-the-giphy-api)

A library providing a PHP interface to the [Giphy API](https://github.com/giphy/GiphyAPI).

Installation
------------

[](#installation)

```
composer require rfreebern/giphy-php

```

Example
-------

[](#example)

There is a file named `giphy` in the `bin` directory. Use it like this:

```
$ ./bin/giphy whiskey

```

GIF Usage
---------

[](#gif-usage)

```
$giphy = new \rfreebern\Giphy();
$result = $giphy->random('whiskey');
print $result->data->image_original_url;

```

By default, the constructor uses the shared beta API key, but if you have a key of your own you can pass it as an argument:

```
$giphy = new \rfreebern\Giphy($my_giphy_api_key);

```

In general, the methods in the `Giphy` class reflect the endpoints of the Giphy API, and take the same arguments.

### search($query, $limit = 25, $offset = 0)

[](#searchquery-limit--25-offset--0)

Searches for gifs matching `$query`.

### getByID($id)

[](#getbyidid)

Fetches a specific GIF by its Giphy ID.

### getByIDs(array $ids)

[](#getbyidsarray-ids)

Fetches one or more specific GIFs by their Giphy IDs.

### translate($query)

[](#translatequery)

Translates a query to a matching GIF. See [the docs](https://github.com/giphy/GiphyAPI#translate-endpoint)for more information.

### random($tag = null)

[](#randomtag--null)

Fetches a random GIF, optionally matching the given tag.

### trending($limit = 25)

[](#trendinglimit--25)

Fetches a list of trending GIFs.

Sticker Usage
-------------

[](#sticker-usage)

```
$sticker = new \rfreebern\Sticker();
$result = $sticker->random('whiskey');
print $result->data->image_original_url;

```

By default, the constructor uses the shared beta API key, but if you have a key of your own you can pass it as an argument:

```
$giphy = new \rfreebern\Giphy($my_giphy_api_key);

```

In general, the methods in the `Giphy` class reflect the endpoints of the Giphy API, and take the same arguments.

### search($query, $limit = 25, $offset = 0)

[](#searchquery-limit--25-offset--0-1)

Searches for stickers matching `$query`.

### translate($query)

[](#translatequery-1)

Translates a query to a matching sticker. See [the docs](https://github.com/giphy/GiphyAPI#translate-endpoint)for more information.

### random($tag = null)

[](#randomtag--null-1)

Fetches a random sticker, optionally matching the given tag.

### trending($limit = 25)

[](#trendinglimit--25-1)

Fetches a list of trending stickers.

Credits
-------

[](#credits)

- This library was created by Ryan Freebern / [@rfreebern](http://twitter.com/rfreebern).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/42315ea4107efcc2dc5df1ae7f6ce9d13ee3c46e51219884102056eab0049746?d=identicon)[rfreebern](/maintainers/rfreebern)

---

Top Contributors

[![rfreebern](https://avatars.githubusercontent.com/u/414858?v=4)](https://github.com/rfreebern "rfreebern (4 commits)")[![StewPoll](https://avatars.githubusercontent.com/u/6897645?v=4)](https://github.com/StewPoll "StewPoll (1 commits)")

### Embed Badge

![Health badge](/badges/rfreebern-giphy-php/health.svg)

```
[![Health](https://phpackages.com/badges/rfreebern-giphy-php/health.svg)](https://phpackages.com/packages/rfreebern-giphy-php)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
