PHPackages                             kiryi/flaryi - 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. kiryi/flaryi

ActiveLibrary[API Development](/categories/api)

kiryi/flaryi
============

Flarum API Client.

1.1.0(6y ago)019GPL-3.0-or-laterPHPPHP ^7.4

Since Apr 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/KiryiMONZTA/flaryi)[ Packagist](https://packagist.org/packages/kiryi/flaryi)[ Docs](https://kiryi.net/)[ RSS](/packages/kiryi-flaryi/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

Kiryi's FLARYI
==============

[](#kiryis-flaryi)

A [Flarum](https://flarum.org/) API client.

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

[](#installation)

```
composer require kiryi/flaryi
```

Usage
-----

[](#usage)

First [initialize](#initialization) the client in one of two possible ways. Then call an [available Endpoint](#available-endpoints) and perform a method associated with it. You will get the response from Flarum's API as a return and may use it in your further logic.

Constructor Definition
----------------------

[](#constructor-definition)

```
__construct(string $filepath = null)
```

### Parameters

[](#parameters)

**filepath**
Optional filepath relative your project's root directory to a custom configuration INI file. If nothing is provided, default (*config/flaryi.ini*) is used ([more information](#initialization)).

Method Definition *call*
------------------------

[](#method-definition-call)

```
call(string $endpoint): object
```

Assigns a variable to the view's data object.

### Parameters

[](#parameters-1)

**endpoint**
One of the available [Endpoints](#available-endpoints).

### Return Values

[](#return-values)

Returns the Endpoint you can then perform one of its associated methods.

Initialization
--------------

[](#initialization)

You have to provide the client at least two mandatory parameters you can must define in a custom configuration INI file or use the default one.

**apiUrl**
The URL of your Flarum's API. Usually it is `{YOURFLARUMDOMAIN}/api`.

**apiKey**
A API key from your Flarum installation. Currently you have to manually create a 40 character long random string and put it directly into your Flarum's databse *api\_keys* table *key* column together with an User ID to the *user\_id* column. The User ID depends on the actions you want to perform. If you want to use every possible API Call, use an Administrator User. If not, you can create a role in your Flarum's administration area with the prefered rights.

Wheter you use a custom or the default file, the contens have to be:

```
[flaryi]
apiUrl = {URLTOYOURFLARUMAPI}
apiKey = {APIKEYFROMYOUFLARUMINSTALLATION}
```

The default filepath is *config/flaryi.ini*. If you want to use a custom filepath, you have to provide it to the [constructor](#constructor-definition) of the client. The path is relative to your project's root directory.

Available Endpoints
-------------------

[](#available-endpoints)

The Flarum API provides some Endpoint you can perform several actions on it. FLARYI covering only some Endpoints and each Endpoint only provides some available methods to perform (actions).

Currently available Endpoints:

- [Discussion](doc/discussion.md)
- [Post](doc/post.md)
- [User](doc/user.md)
- [Tag](doc/tag.md)

Example
-------

[](#example)

*configuration/config.ini*

```
[flaryi]
apiUrl = https://flaryi-flarum.com/api
apiKey = qwe147asd258yxc369rtz123fgh456vbn789ui
```

*src/Controller/UserListController.php*

```
$client = new \Kiryi\Flaryi\Client('configuration/config.ini');
$userList = $client->call('User')->getAll([
    'username',
    'email',
]);
```

will save an object to `$userList` containing all Users of your Flarum. The User objects containg an ID (always), the requested fields *username* and *email* as well as some other information the API provides. Please keep in mind, that not everything can be filtered with an API Call, but you can use the received User list to perform more filtering and e.g. following API Calls like so:

*src/Controller/UserGroupController.php*

```
$user = $client->call('User')->get(5);
if (isset($user->data->relationships->groups->data[0]->id)) {
    $client->call('User')->setGroups(5, [2, 3]);
    echo 'User was added to Group 2 and 3.';
} else {
    echo 'User is already in a Group.';
}
```

This script

- Gets User with ID 5 through an API Call
- Checks if the User has a Group
- If yes, nothing will be changed
- If no, Group 2 and 3 is set to the User through a second API call

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Every ~9 days

Total

2

Last Release

2252d ago

### Community

Maintainers

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

---

Top Contributors

[![oxSteven](https://avatars.githubusercontent.com/u/57273424?v=4)](https://github.com/oxSteven "oxSteven (25 commits)")

### Embed Badge

![Health badge](/badges/kiryi-flaryi/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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