PHPackages                             divineomega/php-stackexchange-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. divineomega/php-stackexchange-search

Abandoned → [jord-jd/php-stackexchange-search](/?search=jord-jd%2Fphp-stackexchange-search)Library[API Development](/categories/api)

divineomega/php-stackexchange-search
====================================

PHP StackExchange Search

v1.1.0(1mo ago)1111LGPL-3.0-onlyPHPPHP &gt;=7.1CI passing

Since Feb 14Pushed 1mo agoCompare

[ Source](https://github.com/Jord-JD/php-stackexchange-search)[ Packagist](https://packagist.org/packages/divineomega/php-stackexchange-search)[ GitHub Sponsors](https://github.com/DivineOmega)[ RSS](/packages/divineomega-php-stackexchange-search/feed)WikiDiscussions master Synced 2d ago

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

PHP Stack Exchange Search
=========================

[](#php-stack-exchange-search)

Search for similar questions on any Stack Exchange network site through the current Stack Exchange API v2.3.

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

[](#installation)

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

Usage
-----

[](#usage)

```
use JordJD\StackExchangeSearch\Enums\Sites;
use JordJD\StackExchangeSearch\StackExchangeSearcher;

$searcher = new StackExchangeSearcher(Sites::STACK_OVERFLOW, $optionalApiKey);

$results = $searcher->search('connect to a database in PHP', [
    'tagged' => ['php', 'database'],
    'nottagged' => ['wordpress'],
    'sort' => 'votes',
    'order' => 'desc',
    'pagesize' => 25,
    'page' => 1,
]);

foreach ($results as $result) {
    echo $result->getTitle();
    echo $result->getDescription();
    echo $result->getUrl();
    echo $result->getQuestionId();
    echo implode(', ', $result->getTags());
    echo $result->getOwner();
    echo $result->getAnswerCount();
    echo $result->isAnswered() ? 'answered' : 'unanswered';
    echo json_encode($result);
}
```

Any valid Stack Exchange API `site` parameter can be used; the `Sites` class contains convenient constants for common sites. An API key is optional but can increase the request quota for registered applications.

Supported search options mirror the official [`/similar` endpoint](https://api.stackexchange.com/docs/similar): `page`, `pagesize` (up to 100), `fromdate`, `todate`, `order`, `min`, `max`, `sort`, `tagged`, and `nottagged`. Invalid inputs fail before an HTTP request is made.

After each request, inspect `hasMore()`, `getQuotaMax()`, `getQuotaRemaining()`, and `getBackoffSeconds()`. If the API supplies a backoff, wait that many seconds before another request.

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

[](#custom-http-transport)

The optional third constructor argument is a callable receiving the URL, headers, and timeout. It must return the response body as a string:

```
$searcher = new StackExchangeSearcher(
    Sites::STACK_OVERFLOW,
    $apiKey,
    function (string $url, array $headers, int $timeout): string {
        return $yourHttpClient->get($url, $headers, $timeout);
    },
    10
);
```

The package supports PHP 7.1 through current PHP 8.x releases.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance94

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 94.1% 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 ~153 days

Total

2

Last Release

32d ago

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

v1.1.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 (16 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/divineomega-php-stackexchange-search/health.svg)

```
[![Health](https://phpackages.com/badges/divineomega-php-stackexchange-search/health.svg)](https://phpackages.com/packages/divineomega-php-stackexchange-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)
