PHPackages                             shanemcc/yasmin - 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. shanemcc/yasmin

ActiveLibrary

shanemcc/yasmin
===============

Yasmin is a Discord API library for PHP.

v0.7.6(5y ago)0199Apache-2.0PHPPHP &gt;=7.1

Since Feb 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ShaneMcC/Yasmin)[ Packagist](https://packagist.org/packages/shanemcc/yasmin)[ RSS](/packages/shanemcc-yasmin/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (10)Versions (15)Used By (0)

**Note:** This is a fork of the original CharlotteDunois/Yasmin repo with additional fixes from other forks.

-

Yasmin
======

[](#yasmin)

Yasmin is a Discord API library for PHP. Yasmin connects to the Gateway and interacts with the REST API.

This library is **only** for PHP 7.1 (and later) and use in CLI. Only bot accounts are supported by Yasmin.

Before you start
================

[](#before-you-start)

Before you start using this Library, you **need** to know how PHP works, you need to know the language and you need to know how Event Loops and Promises work. This is a fundamental requirement before you start. Without this knowledge, you will only suffer.

See  for resources.

Getting Started
===============

[](#getting-started)

Getting started with Yasmin is pretty straight forward. All you need to do is to use [composer](https://packagist.org/packages/shanemcc/yasmin) to install Yasmin and its dependencies. After that, you can include composer's autoloader into your file and start interacting with Discord and Yasmin!

```
composer require shanemcc/yasmin:"dev-master as 1.0.x-dev"

```

It is important to listen to `error` events. If you don't attach an `error` listener, the event emitter will throw an exception.

Make sure you also have a rejection handler for all promises, as unhandled promise rejections get swallowed and you will never know what happened to them.

**Important Information**: All properties on class instances, which are implemented using a magic method (which means pretty much all properties), are **throwing** if the property doesn't exist.

There is a WIP Gitbook with a few protips in it, feel free to read it:

Example
=======

[](#example)

This is a fairly trivial example of using Yasmin. You should put all your listener code into try-catch blocks and handle exceptions accordingly.

```
// Include composer autoloader

$loop = \React\EventLoop\Factory::create();
$client = new \CharlotteDunois\Yasmin\Client(array(), $loop);

$client->on('error', function ($error) {
    echo $error.PHP_EOL;
});

$client->on('ready', function () use ($client) {
    echo 'Logged in as '.$client->user->tag.' created on '.$client->user->createdAt->format('d.m.Y H:i:s').PHP_EOL;
});

$client->on('message', function ($message) {
    echo 'Received Message from '.$message->author->tag.' in '.($message->channel instanceof \CharlotteDunois\Yasmin\Interfaces\DMChannelInterface ? 'DM' : 'channel #'.$message->channel->name ).' with '.$message->attachments->count().' attachment(s) and '.\count($message->embeds).' embed(s)'.PHP_EOL;
});

$client->login('YOUR_TOKEN')->done();
$loop->run();
```

Voice Support
=============

[](#voice-support)

There is no voice support.

Documentation
=============

[](#documentation)

Windows and SSL
===============

[](#windows-and-ssl)

Unfortunately PHP on Windows does not have access to the Windows Certificate Store. This is an issue because TLS gets used and as such certificate verification gets applied (turning this off is **not** an option).

You will notice this issue by your script exiting immediately after one loop turn without any errors. Unfortunately there is for some reason no error or exception.

As such users of this library need to download a [Certificate Authority extract](https://curl.haxx.se/docs/caextract.html) from the cURL website.
The path to the caextract must be set in the [`php.ini`](https://secure.php.net/manual/en/openssl.configuration.php) for `openssl.cafile`.

Linux Support
=============

[](#linux-support)

Use git to clone this repository.

Yasmin requires PHP 7.1+ to run, as well as the following packages. It's recommended to use the latest version of php available in your repository. In the example provided, 7.1 will be used. Replace 7.1 with the version you're currently using.

Ubuntu
------

[](#ubuntu)

```
sudo apt install openssl php7.1 php7.1-bcmath php7.1-mbstring

```

Notice of limited support
=========================

[](#notice-of-limited-support)

I cannot provide support with most issues that occur due to outdated prerequisites or implementing SSL. If you are hosting on Windows and needing a cacert.pem file but don't feel comfortable generating yourself then I personally recommend WinNMP as it generates one in its /data/ directory that you can point your PHP.ini at.

Other distros
-------------

[](#other-distros)

Please refer to your distros repository to find the packages above.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~167 days

Recently: every ~244 days

Total

7

Last Release

2009d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b9eecc6acaa5a3d5532a013209e8029dc9e7c9d9578699211bf0f2135f5a449f?d=identicon)[ShaneMcC](/maintainers/ShaneMcC)

---

Top Contributors

[![valzargaming](https://avatars.githubusercontent.com/u/7202504?v=4)](https://github.com/valzargaming "valzargaming (17 commits)")[![ShaneMcC](https://avatars.githubusercontent.com/u/189723?v=4)](https://github.com/ShaneMcC "ShaneMcC (10 commits)")[![AdamHebby](https://avatars.githubusercontent.com/u/18214951?v=4)](https://github.com/AdamHebby "AdamHebby (3 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")[![sylae](https://avatars.githubusercontent.com/u/2791628?v=4)](https://github.com/sylae "sylae (2 commits)")[![ChalyFlavour](https://avatars.githubusercontent.com/u/15111583?v=4)](https://github.com/ChalyFlavour "ChalyFlavour (1 commits)")[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (1 commits)")[![arcdigital](https://avatars.githubusercontent.com/u/551002?v=4)](https://github.com/arcdigital "arcdigital (1 commits)")[![Hunman](https://avatars.githubusercontent.com/u/7405480?v=4)](https://github.com/Hunman "Hunman (1 commits)")

### Embed Badge

![Health badge](/badges/shanemcc-yasmin/health.svg)

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

###  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)[php-pm/php-pm

PHP-PM is a process manager, supercharger and load balancer for PHP applications.

6.6k441.3k8](/packages/php-pm-php-pm)[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

134391.5k12](/packages/rector-rector-src)[toin0u/geotools

Geo-related tools PHP 7.3+ library

1.4k1.3k](/packages/toin0u-geotools)[clue/docker-react

Async, event-driven access to the Docker Engine API, built on top of ReactPHP.

113154.9k1](/packages/clue-docker-react)

PHPackages © 2026

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