|
@@ -1,3 +1,24 @@
|
|
|
-# phpnotify
|
|
|
|
|
|
|
+# cx-phpnotify
|
|
|
|
|
|
|
|
-This library for work with NTFY.sh in PHP. It use only cURL extension build-in PHP.
|
|
|
|
|
|
|
+## What is it?
|
|
|
|
|
+This small PHP library allows you to send push notifications via the [NTFY.sh](http://ntfy.sh) server. It doesn't rely on any other libraries, simply using the built-in PHP cURL plugin. It's very easy to use in your projects, for example, to add notifications after user interaction.
|
|
|
|
|
+
|
|
|
|
|
+## Small example of use:
|
|
|
|
|
+```php
|
|
|
|
|
+use phpnotify\token_authorization as token_authorization;
|
|
|
|
|
+use phpnotify\notifier as notifier;
|
|
|
|
|
+
|
|
|
|
|
+$url = 'https://ntfy.example.com';
|
|
|
|
|
+$subject = 'topic';
|
|
|
|
|
+$token = 'tk_xyz...';
|
|
|
|
|
+
|
|
|
|
|
+$authorization = new token_authorization($token);
|
|
|
|
|
+$subject = notifier::create($url)->access_method($authorization)->topic($subject);
|
|
|
|
|
+
|
|
|
|
|
+$subject->new_notification('Love yourself!')
|
|
|
|
|
+->title('Hello <3')
|
|
|
|
|
+->add_tag('microbe')
|
|
|
|
|
+->priority(4)
|
|
|
|
|
+->send();
|
|
|
|
|
+
|
|
|
|
|
+```
|