PHPackages                             pbergman/ntfy-php - 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. pbergman/ntfy-php

ActiveLibrary

pbergman/ntfy-php
=================

Library to push messages to a ntfy server

1.2.0(2y ago)1296↓100%1PHPPHP ^7.4||^8.0

Since Oct 4Pushed 2y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (6)Versions (11)Used By (1)

PHP NTFY
========

[](#php-ntfy)

A php library for publishing and subscribing messages to or from a [ntfy](https://ntfy.sh/) server.

### Client

[](#client)

```
use PBergman\Ntfy\Api\Client;
use Symfony\Component\HttpClient\HttpClient;

$client = new Client(
    HttpClient::create([
        'base_uri' => 'https://ntfy.sh',
    ]),
);

```

For authentication the `auth_basic` or `auth_bearer` can be used or use a [AuthenticationInterface](src%2FAuthentication%2FAuthenticationInterface.php) as second argument:

```
use PBergman\Ntfy\Api\Client;
use PBergman\Ntfy\Authentication\BasicAuthentication;
use Symfony\Component\HttpClient\HttpClient;

$client = new Client(
    HttpClient::create([
        'base_uri' => 'https://ntfy.sh',
    ]),
    new BasicAuthentication('username', 'password')
);

```

### Publishing

[](#publishing)

#### Simple message

[](#simple-message)

```
use PBergman\Ntfy\Model\PublishParameters;
use PBergman\Ntfy\Model\HttpAction;

$message = new PublishParameters('Hello world test!!!', 'Test title');
$message->setTags(['foo', 'bar']);
$message->addAction(new HttpAction('Google', 'https://google.nl'));

$response = $client->publish('test', $message);
// will return a async response...
$response()->getId()

```

#### with Attachment

[](#with-attachment)

```
use PBergman\Ntfy\Model\PublishParameters;
use PBergman\Ntfy\Model\HttpAction;

if (false !== $body = file_get_contents('out.txt')) {

    $message = new PublishParameters('Hello world test!!!', 'Test title');
    $message->setFilename('out.txt')
    $message->setTags(['foo', 'bar']);
    $message->addAction(new HttpAction('Google', 'https://google.nl'));

    $client->publish('test', $message, $body);
}

```

### Subscribing

[](#subscribing)

```
use PBergman\Ntfy\Model\SubscribeParameters;

$params = new SubscribeParameters();
$params->setSince('all');

foreach ($client->subscribe('test', $params) as $response) {
    printf("[%s] %s | %s\n", (new \DateTime('@' . $response->getTime()))->format(\DateTime::ATOM), $response->getTitle(), $response->getMessage());
}

```

Or to retrieve all message after a given id

```
use PBergman\Ntfy\Model\SubscribeParameters;

$params = new SubscribeParameters();
$params->setSince('XXXXXXXXXX');
$params->setPoll(true);

$messages = \iterator_to_array($client->subscribe('test', $params));

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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 ~2 days

Total

10

Last Release

929d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce73225a1c546feb93edc48c4b5d514a909aecceddc0fe0a021d4a42d2077e09?d=identicon)[pbergman](/maintainers/pbergman)

---

Top Contributors

[![pbergman](https://avatars.githubusercontent.com/u/1193198?v=4)](https://github.com/pbergman "pbergman (11 commits)")

### Embed Badge

![Health badge](/badges/pbergman-ntfy-php/health.svg)

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

###  Alternatives

[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k348.9M2.5k](/packages/symfony-cache)[symfony/http-client

Provides powerful methods to fetch HTTP resources synchronously or asynchronously

2.0k314.0M3.4k](/packages/symfony-http-client)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

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

8.4k5.6M646](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)

PHPackages © 2026

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