pbergman/ntfy-bundle

There is no license information available for the latest version (1.0.2) of this package.

Symfony bundle for ntfy support

1.0.2 2023-10-20 09:11 UTC

This package is auto-updated.

Last update: 2024-10-20 11:29:03 UTC


README

A symfony bundle that makes it easy to manage multiple nfty servers and topics.

When creating services from the config and autowire is enabled there will parameter binds registered for the server and every topic which can be used arguments.

So for example we have the following config:

framework:
  http_client:
    scoped_clients:
      example.client:
        base_uri: 'https://ntfy.sh'
        auth_bearer: 'XXXXXXXXXXXXX'

p_bergman_ntfy:
  servers:
    example:
      client: example.client
      topics:
        - foo
        - bar

the following binds will be registered:

PBergman\\Bundle\\NtfyBundle\\Api\\StaticTopicClient $exampleFooNtfyClient
PBergman\\Bundle\\NtfyBundle\\Api\\StaticTopicClient $exampleBarNtfyClient
PBergman\\Ntfy\\Api\\Client                          $exampleNtfyClient

And can be used for example if a controller want to publish on foo a message:


public function indexController(Request $request, StaticTopicClient $exampleFooNtfyClient) :Response
{
    $exampleFooNtfyClient->publish(null, 'hello');

Use the

    php bin/console config:dump-reference p_bergman_ntfy

Command to see latest configuration options.