PHPackages                             xwilarg/discord-oauth2-php - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. xwilarg/discord-oauth2-php

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

xwilarg/discord-oauth2-php
==========================

PHP Library for Discord OAuth2

v1.5(5y ago)145721Apache-2.0PHP

Since Apr 19Pushed 4y ago2 watchersCompare

[ Source](https://github.com/Xwilarg/Discord-OAuth2-PHP)[ Packagist](https://packagist.org/packages/xwilarg/discord-oauth2-php)[ RSS](/packages/xwilarg-discord-oauth2-php/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Discord-OAuth2-PHP
==================

[](#discord-oauth2-php)

Discord-OAuth2-PHP is a small PHP library to use Discord OAuth2.

It doesn't intend to cover all the functionalities of Discord OAuth2 but rather to be lightweight (only dependency is curl) and easy to use.

### Dependency

[](#dependency)

To use this library, you must first install php-curl

```
sudo apt-get install php-curl
```

### How to install it ?

[](#how-to-install-it-)

```
$ composer require xwilarg/discord-oauth2-php
```

You can also see the package on [packagist](https://packagist.org/packages/xwilarg/discord-oauth2-php).

### Code sample

[](#code-sample)

See the [sample section](/sample/index.php).

### How to use it ?

[](#how-to-use-it-)

At first you need to go in the [Discord developer page](https://discordapp.com/developers/applications/) and create a new application.
Go in General Information and take your "client id" and "client secret", we will need them later.
Then go in OAuth2, in "Redirects" press the "Add Redirect" button and enter your redirection URL here (the page when the user will be redirected once he is logged with Discord)

You're now ready to write your PHP code, check the [sample section](/sample/index.php) to see how to do so.

If you have any question, feel free to [open an issue](https://github.com/Xwilarg/Discord-OAuth2-PHP/issues).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 91.4% 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 ~227 days

Total

3

Last Release

2123d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/316c851d6ae4a83b1185e048e02e7ea59265bd7d9c49b2155597775b179705c3?d=identicon)[Xwilarg](/maintainers/Xwilarg)

---

Top Contributors

[![Xwilarg](https://avatars.githubusercontent.com/u/20053454?v=4)](https://github.com/Xwilarg "Xwilarg (32 commits)")[![trentwiles](https://avatars.githubusercontent.com/u/59586759?v=4)](https://github.com/trentwiles "trentwiles (3 commits)")

---

Tags

discorddiscord-oauth2oauth2php-discordoauth2oauth2-clientdiscorddiscord-oauth

### Embed Badge

![Health badge](/badges/xwilarg-discord-oauth2-php/health.svg)

```
[![Health](https://phpackages.com/badges/xwilarg-discord-oauth2-php/health.svg)](https://phpackages.com/packages/xwilarg-discord-oauth2-php)
```

###  Alternatives

[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.6k136.0M247](/packages/league-oauth2-server)[league/oauth2-client

OAuth 2.0 Client Library

3.8k118.6M1.2k](/packages/league-oauth2-client)[google/auth

Google Auth Library for PHP

1.4k272.7M161](/packages/google-auth)[knpuniversity/oauth2-client-bundle

Integration with league/oauth2-client to provide services

83416.7M61](/packages/knpuniversity-oauth2-client-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[wohali/oauth2-discord-new

Discord OAuth 2.0 Client Provider for The PHP League OAuth2-Client

116684.7k12](/packages/wohali-oauth2-discord-new)

PHPackages © 2026

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