PHPackages                             phaldan/discourse - 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. phaldan/discourse

ActiveLibrary

phaldan/discourse
=================

Discourse SDK

0.1.0(8y ago)261MITPHPPHP ^7.1

Since Jun 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/phaldan/discourse-sdk)[ Packagist](https://packagist.org/packages/phaldan/discourse)[ RSS](/packages/phaldan-discourse/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

Discourse SDK
=============

[](#discourse-sdk)

[Discourse](https://www.discourse.org/) is the 100% open source discussion platform built for the next decade of the Internet. Use it as a mailing list, discussion forum, long-form chat room, and more!

This SDK provides a synchronous and asynchronous REST client.

REST client
-----------

[](#rest-client)

REST client is a simple endpoint abstraction of the Discourse's REST API ([official documentation](http://docs.discourse.org/)).

### Usage

[](#usage)

#### Get categories (anonymously)

[](#get-categories-anonymously)

Request categories without authentication. Use Promise callback to process request response.

**Synchronous version**

```
$discourse = new \PhALDan\Discourse\Discourse();
$rest = $discourse->rest('https://meta.discourse.org');
$response = $rest->category()->list();
$categories = json_decode($response->getBody()->getContents());
foreach ($categories->category_list->categories as $category) {
    print $category->name.PHP_EOL;
}
```

**Asynchronous version**

```
$discourse = new \PhALDan\Discourse\Discourse();
$rest = $discourse->restAsync('https://meta.discourse.org');
$rest->category()->list()->then(function(\Psr\Http\Message\ResponseInterface $response) {
    $categories = json_decode($response->getBody()->getContents());
    foreach ($categories->category_list->categories as $category) {
        print $category->name.PHP_EOL;
    }
}, function(\Exception $e) {
    print get_class($e).PHP_EOL;
    print $e->getMessage().PHP_EOL;
})->wait();
```

**Result**

```
bug
ux
hosting
support
uncategorized
blog
marketplace
plugin
dev
howto
feature
releases
installation
praise

```

#### API-Token

[](#api-token)

Request categories with invalid credentials.

**Synchronous version**

```
try {
    $discourse = new \PhALDan\Discourse\Discourse();
    $auth = new \PhALDan\Discourse\Client\ApiKeyAuth('phaldan', 'uy284kxc8ou6c38u6...');
    $rest = $discourse->rest('https://meta.discourse.org', $auth);
    $rest->category()->list();
} catch (\Exception $e) {
    print get_class($e).PHP_EOL;
    print $e->getCode().PHP_EOL;
    print $e->getMessage().PHP_EOL;
}
```

**Asynchronous version**

```
try {
    $discourse = new \PhALDan\Discourse\Discourse();
    $auth = new \PhALDan\Discourse\Client\ApiKeyAuth('phaldan', 'uy284kxc8ou6c38u6...');
    $rest = $discourse->restAsync('https://meta.discourse.org', $auth);
    $rest->category()->list()->wait();
} catch (\Exception $e) {
    print get_class($e).PHP_EOL;
    print $e->getCode().PHP_EOL;
    print $e->getMessage().PHP_EOL;
}
```

**Result**

```
/*
 GuzzleHttp\Exception\ClientException
 403
 Client error: `GET https://meta.discourse.org/categories.json?api_username=username&api_key=key` resulted in a `403 Forbidden` response:
 {"errors":["You are not permitted to view the requested resource."],"error_type":"invalid_access"}
 */

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

3265d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/96588edf94180523a43b7bc9310802519a4df51f40a66a014671f8995fdee283?d=identicon)[phaldan](/maintainers/phaldan)

---

Top Contributors

[![phaldan](https://avatars.githubusercontent.com/u/5508270?v=4)](https://github.com/phaldan "phaldan (74 commits)")

---

Tags

discoursephpphp71rest-client

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phaldan-discourse/health.svg)

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

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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