PHPackages                             jord-jd/php-reddit-search - 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. jord-jd/php-reddit-search

ActiveLibrary[API Development](/categories/api)

jord-jd/php-reddit-search
=========================

PHP Reddit Search

v2.0.1(1mo ago)171LGPL-3.0-onlyPHPPHP &gt;=7.1CI passing

Since Feb 14Pushed 1mo agoCompare

[ Source](https://github.com/Jord-JD/php-reddit-search)[ Packagist](https://packagist.org/packages/jord-jd/php-reddit-search)[ GitHub Sponsors](https://github.com/DivineOmega)[ RSS](/packages/jord-jd-php-reddit-search/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

PHP Reddit Search
=================

[](#php-reddit-search)

Search Reddit posts through Reddit's OAuth API and receive normalized search result objects.

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

[](#installation)

```
composer require jord-jd/php-reddit-search
```

Authentication
--------------

[](#authentication)

Reddit requires API clients to authenticate with OAuth and send a unique, descriptive user agent. Create an application in [Reddit's app preferences](https://www.reddit.com/prefs/apps), request a token with the `read` scope, and follow Reddit's [OAuth documentation](https://github.com/reddit-archive/reddit/wiki/OAuth2). Tokens expire, so refresh the token in your application before constructing a new searcher when necessary.

Usage
-----

[](#usage)

```
use JordJD\RedditSearch\RedditSearcher;

$searcher = new RedditSearcher(
    $accessToken,
    'php:your-application:v1.0 (by /u/your_reddit_username)'
);

$results = $searcher->search('PHP programming language', [
    'subreddit' => 'PHP',
    'sort' => 'top',
    'time' => 'year',
    'limit' => 25,
    'include_over_18' => false,
]);

foreach ($results as $result) {
    echo $result->getTitle();
    echo $result->getDescription();
    echo $result->getUrl();
    echo $result->getPermalink();
    echo $result->getSubreddit();
    echo $result->getAuthor();
    echo $result->getScore();
    echo json_encode($result);
}
```

Supported options are `after`, `include_over_18`, `limit` (1 to 100), `sort`(`relevance`, `hot`, `top`, `new`, or `comments`), `subreddit`, and `time`(`hour`, `day`, `week`, `month`, `year`, or `all`). Invalid options fail before an HTTP request is made.

The normalized score ranges from `1.0` for the first result down toward zero. Use `getLastRateLimit()` after a built-in HTTP request to inspect Reddit's `used`, `remaining`, and `reset` rate-limit values. Use `getAfter()` to obtain the next-page cursor and pass it back as the `after` option.

Custom HTTP transport
---------------------

[](#custom-http-transport)

The optional third constructor argument is a callable, useful for applications with an existing HTTP stack. It receives the URL, header array, and timeout, and must return the response body as a string.

```
$searcher = new RedditSearcher(
    $accessToken,
    $userAgent,
    function (string $url, array $headers, int $timeout): string {
        return $yourHttpClient->get($url, $headers, $timeout);
    },
    10
);
```

Version 2 supports PHP 7.1 through current PHP 8.x releases. It replaces the unauthenticated public endpoint used by version 1, which no longer complies with [Reddit's API rules](https://github.com/reddit-archive/reddit/wiki/API).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance94

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90.9% 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 ~77 days

Total

3

Last Release

31d ago

Major Versions

v1.0.0 → v2.0.02026-07-18

PHP version history (2 changes)v1.0.0PHP ^7.4 || ^8.0

v2.0.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/c580cdf7c14898fff179cdfc1085892091d5d2f49d917873a12365af9ac77c93?d=identicon)[Jord-JD](/maintainers/Jord-JD)

---

Top Contributors

[![Jord-JD](https://avatars.githubusercontent.com/u/650645?v=4)](https://github.com/Jord-JD "Jord-JD (10 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jord-jd-php-reddit-search/health.svg)

```
[![Health](https://phpackages.com/badges/jord-jd-php-reddit-search/health.svg)](https://phpackages.com/packages/jord-jd-php-reddit-search)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.5M7](/packages/exsyst-swagger)[lucasdotvin/laravel-soulbscription

A straightforward interface to handle subscriptions and features consumption.

709209.3k](/packages/lucasdotvin-laravel-soulbscription)[pimax/fb-messenger-php

Facebook Messenger Bot PHP API

313188.5k2](/packages/pimax-fb-messenger-php)

PHPackages © 2026

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