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.2.0(2mo ago)105213[3 issues](https://github.com/dc-Ragnarok/Fenrir/issues)[1 PRs](https://github.com/dc-Ragnarok/Fenrir/pulls)MITPHPPHP ^8.5CI passing

Since Feb 1Pushed 2mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (33)Versions (91)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.5+ Tests should pass nightly builds of newer versions, but this is not a supported usecase.

PHP VersionLibrary version8.5+Current8.2, 8.3, 8.4&lt; 1.28.1&lt; 1.0.1Note: Bugfixes/features will not be backported to older versions. Older versions are as-is.

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

53

—

FairBetter than 96% of packages

Maintenance81

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 87.8% 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 ~55 days

Total

77

Last Release

73d ago

Major Versions

0.13.7 → 1.0.02025-01-30

PHP version history (2 changes)1.0.1PHP ^8.2

1.2.0PHP ^8.5

### Community

Maintainers

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

---

Top Contributors

[![Exanlv](https://avatars.githubusercontent.com/u/51094537?v=4)](https://github.com/Exanlv "Exanlv (331 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] (9 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.1k406.5k25](/packages/team-reflex-discord-php)[ccxt/ccxt

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

42.9k337.6k1](/packages/ccxt-ccxt)[statamic/cms

The Statamic CMS Core Package

4.8k3.5M916](/packages/statamic-cms)[web3p/web3.php

Ethereum web3 interface.

1.2k348.3k41](/packages/web3p-web3php)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35729.6k2](/packages/telnyx-telnyx-php)[temporal/sdk

Temporal SDK

4102.7M22](/packages/temporal-sdk)

PHPackages © 2026

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