Skip to content

pbergman/ntfy-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

ntfy bundle

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.

About

Symfony bundle for easily publish and subscribe to server and topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages