PHPackages                             frain/convoy - 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. frain/convoy

ActiveLibrary[API Development](/categories/api)

frain/convoy
============

Convoy PHP SDK Library

v1.0.1(3y ago)21.6kMITPHPPHP ^7.3 || ^8.0

Since Mar 11Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/frain-dev/convoy-php)[ Packagist](https://packagist.org/packages/frain/convoy)[ Docs](https://github.com/frain/convoy)[ RSS](/packages/frain-convoy/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (4)Dependencies (9)Versions (5)Used By (0)

Convoy SDK for PHP
==================

[](#convoy-sdk-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ee5ab903e08604e83c28fded2d73a9bac57ac8de9b68a6805bedfea5785aacf1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f667261696e2f636f6e766f792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/frain/convoy)[![Total Downloads](https://camo.githubusercontent.com/37dd95ccbf6c02f715580c2946699789830c72a9e1b20a57e4b39177739bc161/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f667261696e2f636f6e766f792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/frain/convoy)

This is the Convoy PHP SDK. This SDK contains methods for easily interacting with Convoy's API. Below are examples to get you started. See our [API Reference](https://getconvoy.io/docs/api-reference/welcome) for more.

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

[](#installation)

To install the package, you will need to be using Composer in your project.

The Convoy PHP SDK is not hard coupled to any HTTP Client such as Guzzle or any other library used to make HTTP requests. The HTTP Client implementation is based on [PSR-18](https://www.php-fig.org/psr/psr-18/). This provides you with the convenience of choosing what [PSR-7](https://packagist.org/providers/psr/http-message-implementation) and [HTTP Client](https://packagist.org/providers/psr/http-client-implementation) you want to use.

To get started quickly,

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

### Setup Client

[](#setup-client)

Set up the client with your instance URL, API key, and project ID. Both the API key and project ID are available from your **Project Settings** page.

```
use Convoy\Convoy;

$convoy = new Convoy([
    "uri" => "https://us.getconvoy.cloud/api/v1",
    "api_key" => "your_api_key",
    "project_id" => "your_project_id"
]);
```

Your instance URL depends on where your project lives:

- Convoy Cloud (US): `https://us.getconvoy.cloud/api/v1`
- Convoy Cloud (EU): `https://eu.getconvoy.cloud/api/v1`
- Self-hosted: `https://your-instance/api/v1`

### Create an Endpoint

[](#create-an-endpoint)

An endpoint represents a target URL to receive events.

```
$endpointData = [
    "name" => "default-endpoint",
    "url" => "https://example.com/webhooks/convoy",
    "description" => "Default Endpoint",
    "secret" => "endpoint-secret"
];

$response = $convoy->endpoints()->create($endpointData);
$endpointId = $response["data"]["uid"];
```

### Create a Subscription

[](#create-a-subscription)

Subscriptions route events from a source to an endpoint.

```
$subscriptionData = [
    "name" => "event-sub",
    "endpoint_id" => $endpointId
];

$response = $convoy->subscriptions()->create($subscriptionData);
```

### Sending an Event

[](#sending-an-event)

To send an event, you'll need the `uid` from the endpoint we created earlier.

```
$eventData = [
    "endpoint_id" => $endpointId,
    "event_type" => "payment.success",
    "data" => [
        "status" => "Completed",
        "description" => "Transaction Successful"
    ]
];

$response = $convoy->events()->create($eventData);
```

To fan an event out to all endpoints with the same `owner_id`, or broadcast to every endpoint in the project:

```
$response = $convoy->events()->fanout(["owner_id" => "owner-1", "event_type" => "payment.success", "data" => []]);
$response = $convoy->events()->broadcast(["event_type" => "payment.success", "data" => []]);
```

### Verifying Webhook Signatures

[](#verifying-webhook-signatures)

Verify with the raw request body, before parsing it. Always check the return value: `verify` returns `false` for an invalid simple signature, and throws `WebhookVerificationException` for invalid advanced signatures and malformed headers.

```
use Convoy\Webhook;

$webhook = new Webhook("endpoint-secret");

try {
    $valid = $webhook->verify($rawRequestBody, $_SERVER["HTTP_X_CONVOY_SIGNATURE"]);
} catch (\Convoy\Exceptions\WebhookVerificationException $e) {
    $valid = false;
}

if ($valid !== true) {
    http_response_code(400);
    exit;
}

// signature is valid; process the event
```

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Frain](https://github.com/frain-dev)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance61

Regular maintenance activity

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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 ~101 days

Total

4

Last Release

1305d ago

Major Versions

v0.1.1 → v1.0.02022-12-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f686257c3cf8d0abf4562db4756a9c442902317d634ff0467e1f2868d04679a?d=identicon)[frain](/maintainers/frain)

---

Top Contributors

[![Dotunj](https://avatars.githubusercontent.com/u/11479249?v=4)](https://github.com/Dotunj "Dotunj (21 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")[![mekilis](https://avatars.githubusercontent.com/u/20114018?v=4)](https://github.com/mekilis "mekilis (1 commits)")

---

Tags

webhooksfrainconvoy

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/frain-convoy/health.svg)

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

###  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.

36826.2k2](/packages/telnyx-telnyx-php)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k29.9M340](/packages/openai-php-client)[getbrevo/brevo-php

Official PHP SDK for the Brevo API.

1004.1M58](/packages/getbrevo-brevo-php)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M766](/packages/sylius-sylius)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

86337.5k](/packages/flow-php-flow)[n1ebieski/ksef-php-client

PHP API client that allows you to interact with the API Krajowego Systemu e-Faktur

9082.3k](/packages/n1ebieski-ksef-php-client)

PHPackages © 2026

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