PHPackages                             devmatchable/whop-php-sdk - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. devmatchable/whop-php-sdk

ActiveLibrary[HTTP &amp; Networking](/categories/http)

devmatchable/whop-php-sdk
=========================

Framework-agnostic PHP SDK for the Whop API.

0.0.1(3w ago)030↓100%1MITPHPPHP ^8.4CI passing

Since May 14Pushed 3w agoCompare

[ Source](https://github.com/devmatchable/whop-php-sdk)[ Packagist](https://packagist.org/packages/devmatchable/whop-php-sdk)[ RSS](/packages/devmatchable-whop-php-sdk/feed)WikiDiscussions master Synced 1w ago

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

Whop PHP SDK
============

[](#whop-php-sdk)

[![CI](https://github.com/devmatchable/whop-php-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/devmatchable/whop-php-sdk/actions/workflows/ci.yml)[![PHP](https://camo.githubusercontent.com/270717987f5341772d79b57567226e54ed27b2d4199bbdc98a96e2edf24902fa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342532422d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net/)[![PHPStan](https://camo.githubusercontent.com/6966d12e938c8e61d8f3f99cd5a10aed280cc888326354a93205ab490748870b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c2532306d61782d326136343936)](https://phpstan.org/)

Warning

**This package is in active development and is not yet ready for production use.**The public API may change at any time before version `1.0.0` is released. Please do not depend on it in production projects until a stable release is published.

Framework-agnostic PHP client for the [Whop](https://whop.com) API. Built on pure PSR interfaces (PSR-18 / PSR-17 / PSR-7) — drop it into any PHP 8.4+ project without pulling in a framework or opinionated HTTP stack.

Requirements
------------

[](#requirements)

- PHP 8.4+
- A PSR-18 HTTP client and a PSR-7/17 implementation (your choice — see below)

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

[](#installation)

```
composer require devmatchable/whop-php-sdk
```

The SDK declares only the PSR interface packages and `php-http/discovery` in its `require` block. Concrete HTTP implementations are not bundled — you pick what fits your stack.

**Recommended:** `nyholm/psr7` (PSR-7 + PSR-17) paired with `symfony/http-client`(PSR-18) work well together:

```
composer require nyholm/psr7 symfony/http-client
```

Any other PSR-18 client (`guzzlehttp/guzzle`, etc.) and any PSR-7/17 implementation work as drop-in replacements.

Note

The SDK uses `Symfony\Component\HttpClient\Psr18Client` — the PSR-18 adapter shipped by `symfony/http-client`. This is intentionally different from Symfony's framework-native `HttpClientInterface`, which has a non-PSR shape and isn't compatible with this SDK (or any other PSR-18 consumer). The two interfaces ship from the same package but solve different problems: `HttpClientInterface` is for Symfony-native consumers; `Psr18Client`bridges the same underlying client to the PSR-18 standard the SDK type-hints against.

Quick start
-----------

[](#quick-start)

```
use Matchable\Whop\WhopApiClient;
use Symfony\Component\HttpClient\Psr18Client;

$client = new WhopApiClient(
    httpClient: new Psr18Client(),
    apiKey: $_ENV['WHOP_API_KEY'],
);

// Methods that map to a typed DTO return it directly:
$company = $client->companies->get('biz_xxxxxxxx');
echo $company->name;

// Methods without a DTO return the decoded response array:
$list = $client->companies->list(['page' => 1]);
```

PSR-17 request and stream factories are auto-discovered at construction time via `php-http/discovery` when you omit them. Pass `requestFactory:` and `streamFactory:`explicitly if you want to control which implementation is used.

Error handling
--------------

[](#error-handling)

Every failure surfaces as a `WhopException` — network problems, non-2xx responses, bad JSON, and shape mismatches all go through the same base type, so a single catch covers everything:

```
use Matchable\Whop\Exception\WhopException;

try {
    $payment = $client->payments->get('pay_xxxxxxxx');
} catch (WhopException $e) {
    // always safe to catch here
    echo $e->getMessage();
}
```

When you need to distinguish the failure mode, catch a specific subtype:

```
use Matchable\Whop\Exception\WhopApiException;
use Matchable\Whop\Exception\TransportException;
use Matchable\Whop\Exception\WhopException;

try {
    $payment = $client->payments->get('pay_xxxxxxxx');
} catch (WhopApiException $e) {
    // Non-2xx response from the Whop API
    echo $e->statusCode;       // int — HTTP status code
    print_r($e->responseBody); // array — decoded response body
} catch (TransportException $e) {
    // Network-level failure (DNS, connection refused, etc.)
    echo $e->getMessage();
} catch (WhopException $e) {
    // Anything else: SerializationException, MissingArgumentsException
    echo $e->getMessage();
}
```

The five concrete exception types:

ExceptionWhen it's thrown`WhopApiException`The API returned an HTTP 4xx or 5xx response`TransportException`A network-level PSR-18 failure (connection refused, timeout, etc.)`SerializationException`The request body couldn't be JSON-encoded, or the response body couldn't be decoded`MissingArgumentsException`A required field was absent or invalid when hydrating a typed DTO`WebhookVerificationException`Webhook signature, timestamp, or header verification failed`WhopApiException` exposes two public readonly properties: `statusCode` (int) and `responseBody` (array).

Configuration
-------------

[](#configuration)

The full constructor signature:

```
public function __construct(
    ClientInterface $httpClient,           // PSR-18 client — required
    string $apiKey,                        // Whop API key — required
    string $baseUrl = 'https://api.whop.com/api/v1',  // production default
    ?RequestFactoryInterface $requestFactory = null,   // auto-discovered when null
    ?StreamFactoryInterface $streamFactory = null,     // auto-discovered when null
)
```

To target the Whop sandbox instead of production, pass the sandbox base URL:

```
$client = new WhopApiClient(
    httpClient: new Psr18Client(),
    apiKey: $_ENV['WHOP_SANDBOX_API_KEY'],
    baseUrl: 'https://sandbox-api.whop.com/api/v1',
);
```

If `requestFactory` or `streamFactory` is omitted and no PSR-17 implementation is installed, the constructor throws `Http\Discovery\Exception\NotFoundException` at construction time.

Webhook verification
--------------------

[](#webhook-verification)

`WebhookVerifier` implements the [Standard Webhooks](https://www.standardwebhooks.com/)specification. Both `whsec_` (production) and `ws_` (sandbox) secret formats are supported — construct it with whichever secret is configured in your Whop dashboard:

```
use Matchable\Whop\Exception\WebhookVerificationException;
use Matchable\Whop\Webhook\WebhookVerifier;

$verifier = new WebhookVerifier(webhookSecret: $_ENV['WHOP_WEBHOOK_SECRET']);

// From raw body and headers:
try {
    $verifier->verify($rawBody, $requestHeaders);
} catch (WebhookVerificationException $e) {
    // signature mismatch, stale timestamp, or missing headers
    http_response_code(400);
    exit;
}

// From a PSR-7 request object:
$verifier->verifyRequest($psr7Request);
```

`$requestHeaders` is a case-insensitive array mapping header names to values. The verifier checks for `webhook-id`, `webhook-timestamp`, and `webhook-signature` and enforces a 5-minute timestamp tolerance.

Resources
---------

[](#resources)

Access the API through resource properties on `$client`. Each method returns a typed DTO where one exists, otherwise the raw decoded array:

```
$company  = $client->companies->get('biz_xxxxxxxx');    // Company DTO
$payment  = $client->payments->get('pay_xxxxxxxx');     // Payment DTO
$refund   = $client->payments->refund('pay_xxxxxxxx');  // RefundResponse DTO
$list     = $client->payments->list(['page' => 1]);     // array
```

The SDK covers the full Whop API surface across 57 resource groups. Per-endpoint method signatures and response shapes are documented in the [GitHub Wiki](https://github.com/devmatchable/whop-php-sdk/wiki).

A quick map of what's available:

GroupPropertiesCore`$companies`, `$accountLinks`, `$files`, `$accessTokens`, `$authorizedUsers`, `$users`, `$members`, `$webhooks`Payments &amp; Billing`$payments`, `$checkouts`, `$plans`, `$products`, `$memberships`, `$refunds`, `$invoices`, `$promoCodes`, `$paymentMethods`, `$setupIntents`Platform &amp; Finance`$transfers`, `$feeMarkups`, `$topups`, `$withdrawals`, `$ledgerAccounts`, `$payoutAccounts`, `$payoutMethods`Disputes`$disputes`, `$disputeAlerts`, `$resolutionCenter`Commerce`$shipments`, `$leads`, `$entries`, `$reviews`, `$affiliates`, `$stats`Experiences &amp; Courses`$experiences`, `$courses`, `$courseChapters`, `$courseLessons`, `$courseLessonInteractions`, `$courseStudents`Communication`$chatChannels`, `$dmChannels`, `$dmMembers`, `$messages`, `$reactions`, `$forums`, `$forumPosts`, `$supportChannels`, `$notifications`Advertising`$adCampaigns`, `$adGroups`, `$ads`Apps &amp; AI`$apps`, `$appBuilds`, `$aiChats`, `$tokenTransactions`Verifications`$verifications`Development
-----------

[](#development)

```
composer test       # PHPUnit
composer stan       # PHPStan
composer cs         # PHP-CS-Fixer dry-run
composer cs:fix     # PHP-CS-Fixer apply
composer infection  # Infection mutation testing
```

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance95

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

26d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/99ca2da4eb72149536aad21d87b92c24240bfffea7d702c01bd705b138fa47ad?d=identicon)[ToluTourialai](/maintainers/ToluTourialai)

![](https://www.gravatar.com/avatar/046ec11941ea4d874be32d3e03e97c5c13a9ce951594fd02dfc67792d0742a84?d=identicon)[JeroenMoonen](/maintainers/JeroenMoonen)

---

Top Contributors

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

---

Tags

api-clientpaymentsphpphp-sdkpsr-18psr-7sdkwhopwhop-apipsr-7apisdkpsr-18paymentswhop

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/devmatchable-whop-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/devmatchable-whop-php-sdk/health.svg)](https://phpackages.com/packages/devmatchable-whop-php-sdk)
```

###  Alternatives

[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)[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.1B3.7k](/packages/guzzlehttp-psr7)[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k11](/packages/tempest-framework)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28146.3k](/packages/phpro-http-tools)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

1003.6M46](/packages/getbrevo-brevo-php)

PHPackages © 2026

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