PHPackages                             rennokki/reddit-json-api - 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. rennokki/reddit-json-api

ActiveLibrary[API Development](/categories/api)

rennokki/reddit-json-api
========================

Reddit JSON API offers an easy way to retrieve data from subreddits in no time.

2.5.0(3y ago)217313[3 PRs](https://github.com/renoki-co/reddit-json-api/pulls)Apache-2.0PHPPHP ^8.1CI passing

Since Jan 17Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/renoki-co/reddit-json-api)[ Packagist](https://packagist.org/packages/rennokki/reddit-json-api)[ Docs](https://github.com/renoki-co/reddit-json-api)[ RSS](/packages/rennokki-reddit-json-api/feed)WikiDiscussions master Synced today

READMEChangelog (8)Dependencies (5)Versions (12)Used By (0)

[![CI](https://github.com/renoki-co/reddit-json-api/workflows/CI/badge.svg?branch=master)](https://github.com/renoki-co/reddit-json-api/workflows/CI/badge.svg?branch=master)[![codecov](https://camo.githubusercontent.com/62d8423b01fecd69e718fb32540aacdc631e3741c50f0c2406b852ed12b7384d/68747470733a2f2f636f6465636f762e696f2f67682f72656e6f6b692d636f2f7265646469742d6a736f6e2d6170692f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/renoki-co/reddit-json-api/branch/master)[![StyleCI](https://camo.githubusercontent.com/d9e532c125db748b29e3437c3104f4048e183d4dcabe40d4a6e3cc35fd6e5da2/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136363238393738332f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/166289783)[![Latest Stable Version](https://camo.githubusercontent.com/b92f1630e3aa3227718b25a9d88b68ddb2b69e3cfb26e1cf4be2553bf355bb84/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f7265646469742d6a736f6e2d6170692f762f737461626c65)](https://packagist.org/packages/rennokki/reddit-json-api)[![Total Downloads](https://camo.githubusercontent.com/a455ec0497f2560b46f411b3265b581fc989f96566eb157404a619e0a47cba1f/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f7265646469742d6a736f6e2d6170692f646f776e6c6f616473)](https://packagist.org/packages/rennokki/reddit-json-api)[![Monthly Downloads](https://camo.githubusercontent.com/7f3367404939b641e681abb3c770e58f7322f74959aa8cfac80f1ed448a5c65a/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f7265646469742d6a736f6e2d6170692f642f6d6f6e74686c79)](https://packagist.org/packages/rennokki/reddit-json-api)[![License](https://camo.githubusercontent.com/73d1d1488c1bd0b003016856d7a4024814168a27b9e9c35ff799992cbdded6cd/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f7265646469742d6a736f6e2d6170692f6c6963656e7365)](https://packagist.org/packages/rennokki/reddit-json-api)

Reddit JSON API is a PHP wrapper for handling JSON information from public subreddits.

🚀 Installation
--------------

[](#-installation)

You can install the package via composer:

```
composer require rennokki/reddit-json-api
```

🙌 Usage
-------

[](#-usage)

```
use Rennokki\RedditApi\Reddit;

$app = Reddit::app(
    'renoki-co/reddit-json-api',
    '2.0',
    'web',
    'someusername'
);

$subreddit = Reddit::subreddit(
    'funny', // subreddit name
    $app
);

$posts = $subreddit->get();

foreach ($posts as $post) {
    $id = $post['id'];
}
```

When retrieving posts, the results are wrapped in a `Rennokki\RedditApi\RedditList` class. This class is based on Laravel Collection and you can pipeline actions on it more easily. Please see [Laravel Collections documentantion](https://laravel.com/docs/master/collections).

Pagination
----------

[](#pagination)

For pagination purposes, you shall call `nextPage()` from the previous `$posts`:

```
$subreddit = Reddit::subreddit('funny', $app);

$posts = $subreddit->get();

$nextPageOfPosts = $posts->nextPage();
```

Sorting
-------

[](#sorting)

Reddit allows sorting by posts type. The currently used ones are:

```
public static $sorts = [
    'hot', 'new', 'controversial', 'top', 'rising',
];
```

To apply the sorting, you should call `sort()`:

```
$subreddit = Reddit::subreddit('funny', $app);

$subreddit->sort('top');
```

Time Filtering
--------------

[](#time-filtering)

Same as sorting, time filters are only a few:

```
public static $times = [
    'hour', 'day', 'week', 'month', 'year', 'all',
];
```

```
$subreddit = Reddit::subreddit('funny', $app);

// Top, all time sorting.
$subreddit
    ->sort('top')
    ->time('all');
```

Limit
-----

[](#limit)

By default, each call gives you `20` posts.

```
$subreddit = Reddit::subreddit('funny', $app);

$subreddit->setLimit(100);
```

Debugging
---------

[](#debugging)

If you wish to inspect the URL that is being called, you ca do so:

```
$subreddit = Reddit::subreddit('funny', $app);

$subreddit
    ->setLimit(30)
    ->sort('top')
    ->time('week');

$url = $subreddit->getCallableUrl();
```

🐛 Testing
---------

[](#-testing)

```
vendor/bin/phpunit
```

🤝 Contributing
--------------

[](#-contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

🔒 Security
----------

[](#--security)

If you discover any security related issues, please email  instead of using the issue tracker.

🎉 Credits
---------

[](#-credits)

- [Alex Renoki](https://github.com/rennokki)
- [All Contributors](../../contributors)

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance54

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 76.3% 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.

###  Release Activity

Cadence

Every ~219 days

Recently: every ~235 days

Total

8

Last Release

1132d ago

Major Versions

1.0.0 → 2.0.02020-05-22

PHP version history (4 changes)2.0.0PHP ^7.0

2.3.0PHP ^7.3|^8.0

2.4.0PHP ^8.0

2.5.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21983456?v=4)[rennokki](/maintainers/rennokki)[@rennokki](https://github.com/rennokki)

---

Top Contributors

[![rennokki](https://avatars.githubusercontent.com/u/21983456?v=4)](https://github.com/rennokki "rennokki (90 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (22 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (4 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (2 commits)")

---

Tags

apilaravelpaginationphpphp-wrapperredditreddit-json-apisubredditswrapperjsonapilaravelwrapperreddit

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rennokki-reddit-json-api/health.svg)

```
[![Health](https://phpackages.com/badges/rennokki-reddit-json-api/health.svg)](https://phpackages.com/packages/rennokki-reddit-json-api)
```

###  Alternatives

[aerni/laravel-spotify

A Laravel wrapper for the Spotify Web API

209145.6k](/packages/aerni-laravel-spotify)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[dariusiii/tmdb-laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the wtfzdotnet/php-tmdb-api library.

1821.1k](/packages/dariusiii-tmdb-laravel)[ardakilic/mutlucell

Mutlucell SMS API wrapper for sending sms text messages for Laravel

457.3k](/packages/ardakilic-mutlucell)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)[lasserafn/laravel-economic

Economic REST wrapper for Laravel

1118.5k](/packages/lasserafn-laravel-economic)

PHPackages © 2026

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