PHPackages                             vaizard/glued-lib - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. vaizard/glued-lib

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vaizard/glued-lib
=================

Common code for Glued microservices.

1930[9 issues](https://github.com/vaizard/glued-lib/issues)PHPCI passing

Since Mar 9Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/vaizard/glued-lib)[ Packagist](https://packagist.org/packages/vaizard/glued-lib)[ RSS](/packages/vaizard-glued-lib/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

glued-lib
=========

[](#glued-lib)

Toolkit and dependency abstraction library for the glued project.

Notifications
-------------

[](#notifications)

The notify class uses for most cases the symfony/notifier libraries under the hood, but provides enough abstraction to enable easy integration of other code to communicate on platforms that are unsupported by symfony.

The class requires a yaml configuration, where `dst` in every netowrk is an administrators' destination (recipient) address. In each network (i.e. `email`), multiple (sending) channels can be used. Currently, if the first channel fails to send, the class will try to continue sending by other channels. This failover mechanism (intentionally) doesn't work between networks over privacy/security concerns.

In case of admins, all destinations on all networks are used to really ensure admins get notified. In case of users, users may change define one or more notification channels to be used always and additional channels that can be used only by user choice.

### Configuration

[](#configuration)

To configure notifications, override defaults.yaml. An example here:

```
notify:
    network:
        telegram:
            channels:
                - name: Telegram
                  dsn: 'telegram://123456789:yourbotsecret@default?channel='
            dst:
                - '111111111'
                - '222222222'
            config:
                src: '@MyTelegramBot'
        email:
            channels:
                - name: E-mail (smtp)
                  dsn: 'smtp://login:pass@mx1.example.com:587?encryption=starttls'
                - name: E-mail (smtp2)
                  dsn: 'smtp://login:pass@mx2.example.com:587?encryption=starttls'
            config:
                src: 'sender@example.com'
            dst:
                - 'recipient@gmail.com'
                - 'someotheradmin@outlook.com'
        sms:
            channels:
                - name: Twilio
                  dsn: 'twilio://SID:TOKEN@default?from=FROM'
                - name: O2
            config:
                src: '+1123456789'
```

### Usage

[](#usage)

Send a notification to admins

```
$this->notify->send(content: 'this is the message', subject: 'this is the optional header (i.e. mail subject', notify_admins: true);
```

Send a notification to specific users (all the channels below will be used)

```
$users = [
    '45216b0c-32ca-4a48-8307-3466ee81f32e' => [
        'telegram'  => '222333222',
        'email' => 'user@example.com',
    ],
    '8e51819a-4595-4e5c-990c-f27cacb1a2dd' => [
        'telegram' => '2222777777',
    ],
];
$this->notify->to($users)->send('A quick notification only sent to $users');
```

Helper functions of the class will

```
$res = $this->notify->getusers();
echo "All users to be notified:";
print_r($res);

$res = $this->notify->getadmins();
echo "All admins to be notified:";
print_r($res);

$res = $this->notify->status();
print_r($res);
echo "Current configuration and send queue:";
```

### Supported network/channels are supported

[](#supported-networkchannels-are-supported)

Currently only the following networks/channels are supported:

- TELEGRAM
- EMAIL (SMTP)

**TELEGRAM**

Go to `https://web.telegram.org/k/#@BotFather` and type in

```
/newbot         # start setup
glued-dev       # bot name
glued_dev_bot   # bot username

```

Go to `https://web.telegram.org/k/#@RawDataBot` to get the chat\_id of the recipient

You will end up with something like:

- Token: `1234567890:asecretstringapproximatelythisloong`
- Uri: `https://web.telegram.org/k/#@glued_dev_bot`
- Chat\_id: `2244668800`

and a DSN string `TELEGRAM_DSN=telegram://1234567890:asecretstringapproximatelythisloong@default?channel=2244668800`

To test that the above works, use curl as follows:

```
TG_TOKEN=secret-token
TG_CHAT_ID=recipients-chat-id
curl -X POST -H "Content-Type:multipart/form-data" -F chat_id=$TG_CHAT_ID -F text="message" "https://api.telegram.org/bot$TG_TOKEN/sendMessage"
```

**EMAIL**

To test, use curl as follows:

```
SMTP_HOST='mail.example.com:587'
SMTP_USER='login:pass'
SMTP_FROM='sender@example.com'
SMTP_RCPT='recipient@example.com'

curl --ssl-reqd --url "smtp://$SMTP_HOST" --user "$SMTP_USER" --mail-from "$SMTP_FROM" --mail-rcpt "$SMTP_RCPT" --upload-file file.txt
cat file.txt
From:
To:
Subject: Curl Test
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance42

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity11

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1aa2bc3fba9509b58c205e11ef74ccf62f0fc6c5a798c4f89ff347d5cf5faa4?d=identicon)[killua-eu](/maintainers/killua-eu)

---

Top Contributors

[![killua-eu](https://avatars.githubusercontent.com/u/410734?v=4)](https://github.com/killua-eu "killua-eu (420 commits)")

### Embed Badge

![Health badge](/badges/vaizard-glued-lib/health.svg)

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

PHPackages © 2026

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