webdevvie / pushover-bundle
A symfony2 bundle for pushover
Installs: 66
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.0
- guzzle/guzzle: ~3.7
Requires (Dev)
- mockery/mockery: dev-master
- pdepend/pdepend: ~1.1
- phpmd/phpmd: ~1.5
- phpunit/phpunit: 3.7.*
- squizlabs/php_codesniffer: ~1.4
This package is auto-updated.
Last update: 2024-11-29 05:09:03 UTC
README
This is a simple bundle for Symfony2 to send messages through Pushover. This library is still in development and its interface is subject to change.
Still to do:
- retrieve receipt status
To install
Add it using composer
composer require "webdevvie/pushover-bundle"
Add it to your appkernel registerbundles method
new Webdevvie\PushoverBundle\WebdevviePushoverBundle(),
Add your token to the config
webdevvie_pushover: token: %pushover_token%
Add your token to the parameters yaml file
pushover_token: "your_token_here"
To test this
app/console pushover:send <usertoken>
Follow the questions to send a test message
In your code
Within your application (in this case a controller) you can send a message to a user's pushover using the following code
# get the service from the container; $pushover = $this->get('pushover'); $message = new PushoverMessage(); $message->setUser("usercode_here"); $message->setSound("pushover"); $message->setTitle("A title here"); $message->setMessage("Your message here"); $response = $pushover->sendMessage($message); # Now you can check on the response object with $response->isSent(); # any errors are stored in the $response->getErrors() as an array of strings (isSent will then return false)
If you want to send a message using a higher priority you can set that property on the message object using the constants starting with PRIORITY_
Sounds
All the sounds are available via the ->availableSounds()
method and as a constant starting with SOUND_ in the PushoverMessage class