tykfyr / ntfy-php
Simple PHP wrapper for ntfy.sh.
v1.0.1
2025-04-07 20:07 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^10
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
- Documentation for headers: https://docs.ntfy.sh/publish/#using-http
- This client uses Guzzle for HTTP requests, so you can use all Guzzle features.
π License
This project is licensed under the MIT License. See the LICENSE file for details.