tykfyr/ntfy-php

Simple PHP wrapper for ntfy.sh.

v1.0.1 2025-04-07 20:07 UTC

This package is auto-updated.

Last update: 2025-05-09 12:05:12 UTC


README

A simple PHP wrapper for ntfy.sh – send push notification directly from PHP.

πŸš€ Installation

composer require tykfyr/ntfy-php

πŸ“¦ Usage

use Tykfyr\Ntfy\Client;

$ntfy = new Client('my-topic');

$ntfy->send('Backup job finished!');
$ntfy->send('Deployment failed!', [
    'priority' => 5,
    'title' => '🚨 Fejl i deployment',
    'tags' => ['warning', 'deploy'],
    'click' => 'https://example.com/status'
]);

βš™οΈ Configuration

You can set the default topic and server URL in the constructor:

$ntfy = new Client('alerts', [
    'base_url' => 'https://ntfy.example.com',
    'auth' => 'Bearer your-token'
]);

πŸ§ͺ Test

You can run the tests using PHPUnit. Make sure you have PHPUnit installed and run:

vendor/bin/phpunit

🧠 More information

πŸ“ License

This project is licensed under the MIT License. See the LICENSE file for details.