PHPackages                             hesmatt/discord-hooker - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hesmatt/discord-hooker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hesmatt/discord-hooker
======================

A lightweight Discord webhook client library for PHP

v1.0.0(2y ago)010PHPPHP &gt;=7.0

Since Jul 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/hesmatt/discord-hooker)[ Packagist](https://packagist.org/packages/hesmatt/discord-hooker)[ RSS](/packages/hesmatt-discord-hooker/feed)WikiDiscussions master Synced 1mo ago

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

Discord Hooker
==============

[](#discord-hooker)

Discord Hooker is a lighweight Discord webhook client library for PHP (&gt;=7.0)

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

[](#installation)

You just make your project require it via Composer 👀

```
composer require hesmatt/discord-hooker
```

Usage
-----

[](#usage)

It's pretty simple to use Discord Hooker, let's start with an example that includes just message.

#### Basic usage

[](#basic-usage)

```
use HesMatt\DiscordHooker\Client\Webhook;

$webhook = new Webhook('Your webhook _URL_');

$webhook->setMessage('I am a Discord Hooker');

$webhook->send();
```

The result

[![](https://camo.githubusercontent.com/d8ca2455d6259d422af8b3aeff29e5c1cd977d1f252844d7314692fe5cbfdf19/68747470733a2f2f692e696d6775722e636f6d2f54575a534765362e706e67)](https://camo.githubusercontent.com/d8ca2455d6259d422af8b3aeff29e5c1cd977d1f252844d7314692fe5cbfdf19/68747470733a2f2f692e696d6775722e636f6d2f54575a534765362e706e67)

We can also set the username and image, you can do that via the Webhook settings in Discord as well, but this way we can 'enforce' a different one that's not set there.

Let's change the code a bit

```
use HesMatt\DiscordHooker\Client\Webhook;
use HesMatt\DiscordHooker\Dto\Embed\Embed;

$webhook = new Webhook('Your webhook _URL_');

$webhook->setMessage('I am a Discord Hooker');
$webhook->setUsername('Hooker');
$webhook->setAvatar('The url of your image'); //Note that this always has to be an URL, not a file!

$webhook->send();
```

The result

[![](https://camo.githubusercontent.com/b764f6c97344b625f44f8436fdc6554a43605ed7b14ad43c2affd2f32f097575/68747470733a2f2f692e696d6775722e636f6d2f794e51706950352e706e67)](https://camo.githubusercontent.com/b764f6c97344b625f44f8436fdc6554a43605ed7b14ad43c2affd2f32f097575/68747470733a2f2f692e696d6775722e636f6d2f794e51706950352e706e67)

#### Using embeds

[](#using-embeds)

You are also able to build Embeds and send them, that's probably the thing you'll be using the most, to make your messages look sexy 🌶️

It's not hard to build and add Embed, and the best thing is that you can add as many of them as you want (Or as Discord will let you 😉)

Let's start by building an Embed, an Embed can be something as simple as just a title.

```
use HesMatt\DiscordHooker\Dto\Embed\Embed;

$embed = new Embed();

$embed->setTitle('I am a test embed');

//The description is optional and you don't have to set it, but I wanted to mention is as well :)
$embed->setDescription('I am  test embed description');
```

We need to send it now.

```
use HesMatt\DiscordHooker\Client\Webhook;
use HesMatt\DiscordHooker\Dto\Embed\Embed;

$webhook = new Webhook('Your webhook _URL_');
$embed = new Embed(); //Let's assume we have the different parts we've already built.

//You can use all of the settings for $webhook from earlier, to make the code shorter I won't be typing them again from now on.

$webhook->addEmbed($embed);

$webhook->send();
```

The result

[![](https://camo.githubusercontent.com/bc66f0d31668e1b9bb54c1a1b67cb423e0e2440924eb48621f558811361c65c1/68747470733a2f2f692e696d6775722e636f6d2f795655345075772e706e67)](https://camo.githubusercontent.com/bc66f0d31668e1b9bb54c1a1b67cb423e0e2440924eb48621f558811361c65c1/68747470733a2f2f692e696d6775722e636f6d2f795655345075772e706e67)

The embeds have many settings, I'll be listing them here without 'The result' part, to not make it any longer than it is necessary.

Adding a footer to embed

```
use HesMatt\DiscordHooker\Dto\Embed\Embed;

$embed = new Embed();

$embed->setFooter('The footer text', 'The footer image URL');

//Setting the time part of footer, we can either use
$embed->setTimestamp(new DateTimeImmutable());
//or (To use current time)
$embed->setTimestampNow();
```

Setting a color

```
use HesMatt\DiscordHooker\Dto\Embed\Embed;

$embed = new Embed();

$embed->setColor('327424'); //Discord is using an int value of the color.
```

Setting a thumbnail

```
use HesMatt\DiscordHooker\Dto\Embed\Embed;

$embed = new Embed();

$embed->setThumbnail('Url of the thumbnail image');
```

Adding an author

```
use HesMatt\DiscordHooker\Dto\Embed\Embed;

$embed = new Embed();

$embed->setAuthor('Name of Author','Icon of author','Url of author');
```

Adding a field

```
use HesMatt\DiscordHooker\Dto\Embed\Embed;

$embed = new Embed();

$embed->addField('Text','Value',false); //The last parameter is whether you want the field to be inlined or no.
```

We can of course combine any of these together, note that at least one field is required. So you need either an actual field, or title/description.

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

[](#contributing)

Contributions are always welcome!

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

1029d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/hesmatt-discord-hooker/health.svg)

```
[![Health](https://phpackages.com/badges/hesmatt-discord-hooker/health.svg)](https://phpackages.com/packages/hesmatt-discord-hooker)
```

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

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

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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