PHPackages                             exan/fenrir - 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. exan/fenrir

ActiveLibrary[API Development](/categories/api)

exan/fenrir
===========

Discord API &amp; WS wrapper

1.1.0(2mo ago)9519↓100%3[3 issues](https://github.com/dc-Ragnarok/Fenrir/issues)[1 PRs](https://github.com/dc-Ragnarok/Fenrir/pulls)MITPHPPHP ^8.2CI passing

Since Feb 1Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/dc-Ragnarok/Fenrir)[ Packagist](https://packagist.org/packages/exan/fenrir)[ RSS](/packages/exan-fenrir/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (18)Versions (88)Used By (0)

 [![](./assets/logo.svg)](./assets/logo.svg)

### Fenrir

[](#fenrir)

PHP Discord Interface.

[![Fenrir Code Quality](https://github.com/dc-Ragnarok/Fenrir/actions/workflows/code-quality.yml/badge.svg)](https://github.com/dc-Ragnarok/Fenrir/actions/workflows/code-quality.yml)[![Fenrir Unit Tests](https://github.com/dc-Ragnarok/Fenrir/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/dc-Ragnarok/Fenrir/actions/workflows/unit-tests.yml)

About
-----

[](#about)

Fenrir is a mostly plain wrapper over Discords APIs/gateway. There is no caching built in, this is for the user to implement themselves.

If you're looking for something thats easier to use, has caching OOTB, you could consider [Laracord](https://github.com/laracord/framework)

Fenrir heavily relies on ReactPHP for async operations. Knowing the basics of async PHP is recommended before diving in.

Join the [Discord](https://discord.gg/KMYPcDAYwb) for discussion &amp; support!

Install
-------

[](#install)

```
composer require ragnarok/fenrir

```

Example bot
-----------

[](#example-bot)

```
use Ragnarok\Fenrir\Bitwise\Bitwise;
use Ragnarok\Fenrir\Constants\Events;
use Ragnarok\Fenrir\Discord;
use Ragnarok\Fenrir\Enums\Intent;
use Ragnarok\Fenrir\Gateway\Events\MessageCreate;
use Ragnarok\Fenrir\Rest\Helpers\Channel\MessageBuilder;

require './vendor/autoload.php';

$discord = new Discord('TOKEN');

$discord
    ->withGateway(Bitwise::from(
        Intent::GUILD_MESSAGES,
        Intent::DIRECT_MESSAGES,
        Intent::MESSAGE_CONTENT,
    ))
    ->withRest();

$discord->gateway->events->on(Events::MESSAGE_CREATE, function (MessageCreate $message) use ($discord) {
    if ($message->content === '!ping') {
        $discord->rest->channel->createMessage(
            $message->channel_id,
            (new MessageBuilder())
                ->setContent('pong!')
        );
    }
});

$discord->gateway->open(); // Nothing after this line is executed
```

REST-only example
-----------------

[](#rest-only-example)

```
use Ragnarok\Fenrir\Discord;
use Ragnarok\Fenrir\Rest\Helpers\Channel\MessageBuilder;

require './vendor/autoload.php';

$discord = new Discord('TOKEN');
$discord->withRest();

$discord->rest->channel->createMessage(
    'channel-id',
    (new MessageBuilder())
        ->setContent('Hi there!')
);
```

(Note: going with REST-only means you do NOT receive any events and your bot will appear offline)

For more examples, check out the examples directory

Support
-------

[](#support)

Fenrir currently supports PHP 8.2+ Tests should pass nightly builds of newer versions, but this is not a supported usecase.

If you're using this in a Apache2/Nginx/etc webserver environment, you should probably limit yourself to only using Fenrir's REST capabilities. These environments typically don't allow long-running processes.

32-bit is not supported, though no hard limit is in place.

Contributing
------------

[](#contributing)

Contributions are welcome. You can look for `@todo` to find something that requires attention. Please make sure to write tests where possible &amp; make sure your code matches the phpcs configuration. Thanks!

Notice
------

[](#notice)

The current underlying HTTP component is subject to change in the future. While the accesible API for it will remain similar, you should try to refrain from using it manually in your application.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance81

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 88% 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 ~15 days

Recently: every ~48 days

Total

76

Last Release

60d ago

Major Versions

0.13.7 → 1.0.02025-01-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a13e10cab42385db1f6f4f0bfd96f8c63ec419746648db02b30e7ea02d2f5df?d=identicon)[exan](/maintainers/exan)

---

Top Contributors

[![Exanlv](https://avatars.githubusercontent.com/u/51094537?v=4)](https://github.com/Exanlv "Exanlv (329 commits)")[![xHeaven](https://avatars.githubusercontent.com/u/14284867?v=4)](https://github.com/xHeaven "xHeaven (27 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![Naneynonn](https://avatars.githubusercontent.com/u/42908112?v=4)](https://github.com/Naneynonn "Naneynonn (5 commits)")[![CommandString](https://avatars.githubusercontent.com/u/44886996?v=4)](https://github.com/CommandString "CommandString (2 commits)")[![MatthewSH](https://avatars.githubusercontent.com/u/3768988?v=4)](https://github.com/MatthewSH "MatthewSH (1 commits)")[![PhaxeNor](https://avatars.githubusercontent.com/u/323222?v=4)](https://github.com/PhaxeNor "PhaxeNor (1 commits)")[![freezemage0](https://avatars.githubusercontent.com/u/48737675?v=4)](https://github.com/freezemage0 "freezemage0 (1 commits)")

---

Tags

discorddiscord-api

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/exan-fenrir/health.svg)

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

###  Alternatives

[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k379.4k24](/packages/team-reflex-discord-php)[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

41.5k328.9k1](/packages/ccxt-ccxt)[web3p/web3.php

Ethereum web3 interface.

1.3k325.5k41](/packages/web3p-web3php)[mpociot/slack-client

A better Slack client, with RTM API support

51263.6k1](/packages/mpociot-slack-client)[clue/reactphp-eventsource

Instant real-time updates. Lightweight EventSource client receiving live messages via HTML5 Server-Sent Events (SSE). Fast stream processing built on top of ReactPHP's event-driven architecture.

5818.5k3](/packages/clue-reactphp-eventsource)

PHPackages © 2026

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