PHPackages                             tatter/reddit - 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. tatter/reddit

ActiveLibrary[API Development](/categories/api)

tatter/reddit
=============

Reddit SDK for CodeIgniter 4

v1.1.1(3y ago)19301[1 PRs](https://github.com/tattersoftware/codeigniter4-reddit/pulls)MITPHPPHP ^7.4 || ^8.0

Since Nov 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/tattersoftware/codeigniter4-reddit)[ Packagist](https://packagist.org/packages/tatter/reddit)[ Docs](https://github.com/tattersoftware/codeigniter4-reddit)[ Fund](https://paypal.me/tatter)[ GitHub Sponsors](https://github.com/tattersoftware)[ RSS](/packages/tatter-reddit/feed)WikiDiscussions develop Synced 1w ago

READMEChangelog (4)Dependencies (2)Versions (7)Used By (0)

codeigniter4-reddit
===================

[](#codeigniter4-reddit)

Reddit SDK for CodeIgniter 4

[![](https://github.com/tattersoftware/codeigniter4-reddit/workflows/PHPUnit/badge.svg)](https://github.com/tattersoftware/codeigniter4-reddit/actions?query=workflow%3A%22PHPUnit)[![](https://github.com/tattersoftware/codeigniter4-reddit/workflows/PHPStan/badge.svg)](https://github.com/tattersoftware/codeigniter4-reddit/actions?query=workflow%3A%22PHPStan)

Quick Start
-----------

[](#quick-start)

1. Install with Composer: `> composer require tatter/reddit`
2. Supply Reddit credentials in **.env**
3. Get API results:

```
foreach (service('reddit')->fetch('new') as $thing)
{
	echo (string) $thing; // "Comment" or "Link"
	echo $thing->link_permalink; // E.g. "https://www.reddit.com/r/pythonforengineers/comments/jox9zy/great_video_for_the_python_programers"
}

```

Description
-----------

[](#description)

**Reddit SDK** provides a framework-ready wrapper to the API endpoints describe in the [Reddit API documentation](https://www.reddit.com/dev/api).

Configuration (optional)
------------------------

[](#configuration-optional)

The library's default behavior can be altered by extending its config file. Copy **examples/Reddit.php** to **app/Config/** and follow the instructions in the comments. If no config file is found in **app/Config** then the library will use its own.

Credentials
-----------

[](#credentials)

This library requires a valid Reddit application to acquire access tokens that work with API. For more details read the [Reddit OAuth2 wiki](https://github.com/reddit-archive/reddit/wiki/OAuth2).

1. Login to Reddit and visit the "authorized applications" page ()
2. Under "developed applications" select "create an app..."
3. Select "script" as the application type
4. Provide a name, description, and URLs in the required text fields
5. Select "create app"

Once your application is created you will need to copy the "client ID" and "secret" (see the wiki article above for help). Add these along with your username and password into your project's **.env** file, for example:

```
#--------------------------------------------------------------------
# REDDIT API
#--------------------------------------------------------------------

reddit.clientId = as98-asdn3h93r
reddit.clientSecret = LKhsa-ASJDn9a8sdion_laskdn0
reddit.username = MyFiRsTrEdItTbOt
reddit.password = ReallySecurePassword321

```

Usage
-----

[](#usage)

The easiest way to access the client is via the CodeIgniter's Services:

```
$reddit = service('reddit');

```

The client will handle authentication (assuming your credentials are valid), rate limiting, response filtering and formatting. Access client methods in chains to set up the request, then use `fetch()` to kick it off:

```
$comments = $reddit->subreddit('catgifs')->limit(10)->fetch('comments');

```

For more advanced needs you may use the `request($uri, $data, $query)` method which returns the actual `Response` object, providing access to headers, etc. See also **HTTP/RedditRequest.php** and **HTTP/RedditResponse.php** for some of the API handling done "under the hood".

Troubleshooting
---------------

[](#troubleshooting)

Should something go wrong all anticipated exceptions are wrapped in `Tatter\Reddit\Exceptions\RedditException`, so you can catch them and figure out what happened:

```
try
{
	$comments = $reddit->subreddit('php')->fetch('new');
}
catch (\Tatter\Reddit\Exceptions\RedditException $e)
{
	echo $e->getMessage(); // "API responded with an error: Invalid authorization"
}

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 97.6% 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 ~183 days

Total

4

Last Release

1453d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.2

v1.1.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ebe908b4fe73807ecdd9f88733342199c9991b7de800329f5b2b787c8210d62?d=identicon)[MGatner](/maintainers/MGatner)

---

Top Contributors

[![MGatner](https://avatars.githubusercontent.com/u/17572847?v=4)](https://github.com/MGatner "MGatner (41 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

sdkcodeigniterredditcodeigniter4

### Embed Badge

![Health badge](/badges/tatter-reddit/health.svg)

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

###  Alternatives

[tatter/firebase

Firebase integration for CodeIgniter 4

298.2k](/packages/tatter-firebase)[appwilio/cdek-sdk

CDEK API SDK (cdek.ru)

406.5k](/packages/appwilio-cdek-sdk)[tatter/stripe

Stripe SDK integration for CodeIgniter 4

115.3k](/packages/tatter-stripe)[mocking-magician/coinbase-pro-sdk

Library for coinbase pro API calls

223.2k](/packages/mocking-magician-coinbase-pro-sdk)

PHPackages © 2026

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