thinwrap/notifications

thinwrap/notifications for PHP — unified facade over 35 notification providers across email, SMS, push, and chat. Stateless, BYO PSR-18 client, no vendor SDKs.

PHP constraints

Runtime dependencies
php-http/discovery, psr/http-client, psr/http-factory
BYO HTTP client
consumer-supplied PSR-18 client via php-http/discovery
Provenance
cosign-signed GitHub Release artifacts
Minimum runtime
PHP 8.2+
  • PSR-17/PSR-18 discovery is auto-detected; consumers can also pass clients explicitly

30-second install

composer require thinwrap/notifications

2-minute end-to-end example

Send an email through any supported provider via one normalized call. The example below uses SendGrid; switching providers means changing the provider ID and config — input and output shape stay identical.

<?php
use Thinwrap\Notifications\Facade\Email;
use Thinwrap\Notifications\Enum\NotificationsProviderId;
use Thinwrap\Notifications\Config\SendgridConfig;

$email = new Email(
    NotificationsProviderId::Sendgrid,
    new SendgridConfig(apiKey: getenv('SENDGRID_API_KEY'), from: 'you@example.com'),
);

$email->send([
    'to' => 'user@example.com',
    'subject' => 'Hello',
    'text' => 'Hello world',
]);

Same code works for all supported providers — swap the provider id case and config DTO. The supported-providers list below is auto-sourced from the catalog.

See the universal email snippet for the full copy-paste pattern.

Supported providers

35 providers ship with thinwrap/notifications@1.0.0.
ProviderChannelAuthREADME
sendgrid SendGridemailbearerdocs
ses AWS SESemailaws-sig-v4docs
mailgun Mailgunemailbasicdocs
postmark Postmarkemailheaderdocs
resend Resendemailbearerdocs
brevo Brevo (Sendinblue)emailheaderdocs
mailersend MailerSendemailbearerdocs
mailtrap Mailtrapemailbearerdocs
sparkpost SparkPostemailheaderdocs
scaleway Scalewayemailheaderdocs
twilio Twiliosmsbasicdocs
vonage Vonagesmsquerydocs
plivo Plivosmsbasicdocs
sns AWS SNSsmsaws-sig-v4docs
messagebird MessageBird (Bird)smsheaderdocs
infobip Infobipsmsheaderdocs
telnyx Telnyxsmsbearerdocs
sinch Sinchsmsbearerdocs
textmagic Textmagicsmsheaderdocs
d7networks D7 Networkssmsbearerdocs
fcm Firebase Cloud Messagingpushrs256-jwtdocs
apns Apple Push Notificationspushes256-jwtdocs
expo Expo Pushpushbearerdocs
one-signal OneSignalpushheaderdocs
pusher-beams Pusher Beamspushbearerdocs
wonderpush WonderPushpushbearerdocs
slack Slackchatwebhook-urldocs
discord Discordchatwebhook-urldocs
ms-teams Microsoft Teamschatwebhook-urldocs
telegram Telegramchatwebhook-urldocs
whatsapp-business WhatsApp Businesschatbearerdocs
line LINEchatbearerdocs
google-chat Google Chatchatwebhook-urldocs
rocket-chat Rocket.Chatchatwebhook-urldocs
mattermost Mattermostchatwebhook-urldocs

Migration paths

From sendgrid/sendgrid (or any vendor SDK)

Drop the vendor SDK; the wrapper produces the same outbound HTTP call via your PSR-18 client of choice. Vendor-specific fields stay accessible through _passthrough.

- use SendGrid\Mail\Mail;
- $sg = new \SendGrid(getenv('SENDGRID_API_KEY'));
- $sg->send($mail);
+ use Thinwrap\Notifications\Facade\Email;
+ use Thinwrap\Notifications\Enum\NotificationsProviderId;
+ use Thinwrap\Notifications\Config\SendgridConfig;
+ $email = new Email(NotificationsProviderId::Sendgrid, new SendgridConfig(apiKey: getenv('SENDGRID_API_KEY'), from: 'you@example.com'));
+ $email->send(['to' => 'user@example.com', 'subject' => 'Hi', 'text' => 'Hello world']);

From hand-rolled cURL or Guzzle

Keep your PSR-18 client; replace the per-vendor request shape with one uniform call. The wrapper performs no automatic retry — compose your own from ConnectorError->providerCode and the rawRetry-After header on $e->cause.

Note: Novu has no native PHP package, so a Novu PHP migration path is not applicable.

Read more