PHPackages                             drewlabs/envoyer - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. drewlabs/envoyer

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

drewlabs/envoyer
================

Envoyer client library

v0.2.6(1y ago)01278MITPHPPHP &gt;=7.0

Since Jun 11Pushed 1y agoCompare

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

READMEChangelogDependencies (3)Versions (7)Used By (8)

Envoyer
=======

[](#envoyer)

Client library for sending text message, email, etc... notification using various adapters / drivers.

Usage
-----

[](#usage)

The library requires drivers for supported providers like \[ `Amazon AWS SES` \], \[ `TWILIO Sendgrid` \] driver (for sending mail using \[ `Twilio Sendgrid PHP API` \]), \[SMTP\] driver (for sending mails using an SMTP connection), \[ `Twilio Message API` \] (For sending Text message using Twilio), and SMPP driver (for sending message using an SMPP connection to an SMPP server), etc.

\-- Sending an mail

For simple mail (mail without attachment), there is no need to implements \[Drewlabs\\Contracts\\Notification\\AttachmentsNotification\] as it is only required for mails with attachments.

```
// Create a notification class

// Mail.php

use Drewlabs\Envoyer\Contracts\AttachmentsAware;
use Drewlabs\Envoyer\Contracts\NotificationInterface;
use SplFileInfo;

/** @package Drewlabs\Notifications\Tests\Stubs */
class Mail implements NotificationInterface, AttachmentsAware
{

    public function setAttachments($attachments = [])
    {
    }

    public function getAttachments()
    {
        return [
            new SplFileInfo(__DIR__ . '/../contents/bordereau.pdf'),
        ];
    }
    public function getCc()
    {
        return null;
    }

    public function getSubject()
    {
        return "Successful registration";
    }

    public function getSender()
    {
        return new Address;
    }

    public function getReceiver()
    {
        return "azandrewdevelopper@gmail.com";
    }

    public function getContent()
    {
        return "Hey Azandrew! Thank you for your registration";
    }
}

// defines a test driver to use
DriverRegistryFacade::defineDriver('test', static function () {
    return new TestDriver();
});

// Send notification using command interface
$result = $command->driver('test')->send(new Mail);
```

- SMTP

\-- Integration

> composer require drewlabs/envoyer-smtp

\-- Sending mail

```
// SendMail.php
$result = $command->driver('smtp')->send(new Mail);
```

- Twilio Message API

\-- Installation

> composer require drewlabs/envoyer-twilio

\-- Sending Text Message

```
// SendMessage.php
$result = $command->driver('smtp')->send(new Message);
```

- SMPP Server

\-- Installation

> composer require drewlabs/envoyer-smpp

\-- Sending Text messages

```
// SendMessage.php
$result = $command->driver('smpp')->send(new Message);
```

- Custom Driver

Custom / Thrird party drivers implementations must implements \[Drewlabs\\Envoyer\\Contracts\\ClientInterface\] and define the custom logic to send notification.

```
use Drewlabs\Envoyer\Contracts\ClientInterface;
use Drewlabs\Envoyer\Contracts\NotificationInterface;
use Drewlabs\Envoyer\Contracts\NotificationResult;
use RuntimeException;

class TestDriver implements ClientInterface
{

    public function __construct()
    {
    }

    public function sendRequest(NotificationInterface $instance): NotificationResult
    {
        // TODO : Provide send request implementation logic
    }
}
```

API
---

[](#api)

- Mail builder

The `mail builder` class is a fluent interface for building mail notifications.

Example:

```
// Start building the mail
$mail = \Drewlabs\Envoyer\Mail::new()
    ->from('...', '...')
    ->to('...')
    ->bCc('...')
    ->subject('...')
    ->attach(new SplFileInfo(__DIR__ . '/...'))
    ->content(require __DIR__ . '/...');

// TODO: Send the mail messge using the required driver API
```

- Text Messages builder

The `text message builder` is a fluent interface for building text messages to be send as notification instance.

```
// Create a messageable class
$message = Messageable::new()
                        ->from('...')
                        ->to('...')
                        ->content("...");

// Use required driver to send the notification message
```

- Driver Enum

To avoid typo error for driver names, implementation comes with PHP constant that can be use when contructing command:

```
use Drewlabs\Notifications\Command;
use Drewlabs\Notifications\Drivers;

$result = Command::driver(Drivers::AWS_SES)->send(/* ... */);
```

- The Drivers registry

The `drivers registry` is a singleton class that allow application developper to register and create notification drivers.

```
use Drewlabs\Envoyer\DriverRegistryFacade;

DriverRegistryFacade::defineDriver('test', static function () {
    return new TestProvider();
});
```

**Note** The factory function/closure passed as parameter to `defineDriver` must return an instance of `Drewlabs\Envoyer\Contracts\ClientInterface` else the driver resolver will throw an exception.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance43

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity33

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

Every ~123 days

Recently: every ~154 days

Total

6

Last Release

453d ago

PHP version history (2 changes)v0.2.0PHP &gt;=7.2

v0.2.2PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/48c4973d500c7f4233d5ceacab51a57208d5fb60b0f95ae60264cf92380d0534?d=identicon)[azandrew-sidoine](/maintainers/azandrew-sidoine)

---

Top Contributors

[![azandrew-sidoine](https://avatars.githubusercontent.com/u/23530515?v=4)](https://github.com/azandrew-sidoine "azandrew-sidoine (11 commits)")

---

Tags

mailnotificationsms

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/drewlabs-envoyer/health.svg)

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

###  Alternatives

[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[gr8shivam/laravel-sms-api

A modern, flexible Laravel package for integrating any SMS gateway with REST API support

10138.4k](/packages/gr8shivam-laravel-sms-api)[kitist/html5_notifier

Desktop Notifications for Roundcube

7710.9k](/packages/kitist-html5-notifier)[ghasedak/php

ghasedak sms gateway package for PHP

2044.3k7](/packages/ghasedak-php)[taiwan-sms/every8d

every8d sms api client

1817.8k](/packages/taiwan-sms-every8d)[juanparati/brevosuite

Complete Brevo integration with Laravel

1010.8k](/packages/juanparati-brevosuite)

PHPackages © 2026

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