Giter VIP home page Giter VIP logo

pushoverbundle's Introduction

PushoverBundle

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

pushoverbundle's People

Contributors

webdevvie avatar

Watchers

D. Casanuova avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.