PHPackages                             apialerts/apialerts - 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. apialerts/apialerts

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

apialerts/apialerts
===================

PHP client SDK for API Alerts: effortless project notifications

1.0.0(yesterday)02↑2900%1MITPHPPHP &gt;=8.1

Since Jan 8Pushed yesterday1 watchersCompare

[ Source](https://github.com/apialerts/apialerts-php)[ Packagist](https://packagist.org/packages/apialerts/apialerts)[ Docs](https://apialerts.com)[ RSS](/packages/apialerts-apialerts/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (3)Versions (4)Used By (0)

API Alerts • PHP Client
=======================

[](#api-alerts--php-client)

[![Packagist](https://camo.githubusercontent.com/6fbe0f534c2264a611c9ef2dfe39cea4e03c0a3a4f1907a78200e5d03f21cf38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617069616c657274732f617069616c65727473)](https://packagist.org/packages/apialerts/apialerts)[![PHP](https://camo.githubusercontent.com/6518db1335bf20fdff07253dc6d6d0cec955b5fb6a8ef1382ac6d73687ecc07f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d626c7565)](https://www.php.net/)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](LICENSE)

Official PHP SDK for [API Alerts](https://apialerts.com): effortless project notifications. Send once, deliver everywhere.

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

[](#installation)

```
composer require apialerts/apialerts
```

Quick Start
-----------

[](#quick-start)

```
use ApiAlerts\ApiAlerts;
use ApiAlerts\Event;

ApiAlerts::configure('your-api-key');

// Fire-and-forget (never throws)
ApiAlerts::send(new Event(message: 'Deploy complete'));

// Blocking: returns SendResult, never throws
$result = ApiAlerts::sendAsync(new Event(
    message: 'Deploy complete',
    channel: 'releases',
    event:   'ci.deploy',
    title:   'Deployed',
    tags:    ['CI/CD', 'PHP'],
    link:    'https://github.com/your-org/your-repo/actions',
    data:    ['version' => '1.0.0'],
));

if ($result->success) {
    echo "Sent to {$result->workspace} / {$result->channel}\n";
    foreach ($result->warnings as $w) {
        echo "Warning: $w\n";
    }
} else {
    echo "Failed: {$result->error}\n";
}
```

API
---

[](#api)

MethodDescription`ApiAlerts::configure(string $apiKey, bool $debug = false)`Initialise the singleton. First call wins; later calls are no-ops. `debug: true` logs results via `error_log()`.`ApiAlerts::send(Event $event, ?string $apiKey = null)`Fire-and-forget. Never throws. Critical errors always log; HTTP results only log in debug.`ApiAlerts::sendAsync(Event $event, ?string $apiKey = null)`Blocks, returns `SendResult`. Never throws; check `$result->success`.Pass `$apiKey` on either send to override the configured key for that one call (e.g. routing to multiple workspaces).

Dependency Injection
--------------------

[](#dependency-injection)

The static `ApiAlerts` facade is the quickest way to send. When you need DI, mocking in tests, or multiple keys side by side, construct the instance client directly and type-hint against `ApiAlertsClientInterface`:

```
use ApiAlerts\ApiAlertsClientInterface;
use ApiAlerts\Client;
use ApiAlerts\Event;

$client = new Client('your-api-key');
$client->send(new Event(message: 'Deploy complete'));
```

In a Laravel service provider, bind the interface so the container injects it for you:

```
use ApiAlerts\ApiAlertsClientInterface;
use ApiAlerts\Client;

$this->app->singleton(ApiAlertsClientInterface::class, fn () => new Client(config('services.apialerts.key')));
```

```
class DeployNotifier
{
    public function __construct(private ApiAlertsClientInterface $alerts) {}

    public function notify(): void
    {
        $this->alerts->send(new Event(message: 'Deploy complete'));
    }
}
```

In tests, pass a mock of `ApiAlertsClientInterface` instead. The `ApiAlerts` singleton is a thin facade over a default `Client`, so the static and instance surfaces never drift.

Result Checking
---------------

[](#result-checking)

`sendAsync()` always returns a `SendResult`. Check `$result->success`:

```
$result = ApiAlerts::sendAsync(new Event(message: 'Deploy complete'));

if ($result->success) {
    echo "Sent to {$result->workspace} ({$result->channel})\n";
    foreach ($result->warnings as $warning) {
        echo "Warning: {$warning}\n";
    }
} else {
    echo "Error: {$result->error}\n";
}
```

### `SendResult` fields

[](#sendresult-fields)

FieldTypeDescription`success``bool``true` if the event was accepted by the API`workspace``?string`Workspace name (present on success)`channel``?string`Channel name (present on success)`warnings``array`Non-fatal warnings returned by the API`error``?string`Error message (present on failure)Event Fields
------------

[](#event-fields)

FieldTypeRequiredDescription`message``string`YesMain notification message (push lock-screen text)`channel``string`NoTarget channel name (defaults to the workspace default)`event``string`NoRouting key, dotted notation (e.g. `ci.deploy.success`)`title``string`NoShort headline some destinations render separately`tags``string[]`NoCategorisation tags`link``string`NoURL the push opens`data``array`NoArbitrary key-value metadata for non-push destinationsNull fields are omitted from the JSON payload automatically.

Running the Sample
------------------

[](#running-the-sample)

```
export APIALERTS_API_KEY=your-api-key

# CI flag variants
php sample/run.php --build
php sample/run.php --release
php sample/run.php --publish
php sample/run.php --integration-tests
```

Running Tests
-------------

[](#running-tests)

```
composer install
composer test     # phpunit
composer lint     # php-cs-fixer (dry run)
```

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

[](#requirements)

- PHP 8.1+
- [GuzzleHttp](https://docs.guzzlephp.org/) 7.x

Every request uses a 30-second timeout.

License
-------

[](#license)

MIT. See [LICENSE](LICENSE).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/155797644?v=4)[API Alerts](/maintainers/apialerts)[@apialerts](https://github.com/apialerts)

---

Tags

api-clientapialertsnotificationsphpsdksdknotificationsalertsapialerts

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k532.1M2.5k](/packages/aws-aws-sdk-php)[minishlink/web-push

Web Push library for PHP

1.9k13.4M69](/packages/minishlink-web-push)[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NotifyX、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

687111.2k8](/packages/guanguans-notify)[bentools/webpush-bundle

Send push notifications through Web Push Protocol to your Symfony users.

72285.7k](/packages/bentools-webpush-bundle)[redjanym/php-firebase-cloud-messaging

PHP SDK for Firebase Cloud Messaging from Google

37858.2k2](/packages/redjanym-php-firebase-cloud-messaging)[awssat/discord-notification-channel

Discord Notification Channel for laravel.

94128.8k](/packages/awssat-discord-notification-channel)

PHPackages © 2026

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