Giter VIP home page Giter VIP logo

pushoverbundle-1's Introduction

PushoverBundle

Provide some tools to use Pushover in a symfony 2 project.

What's Pushover ?

Pushover is a simple notification provider for Android, iPhone, iPad, and Desktop.

Further information.

Installation

  • Create an account on Pushover.
  • On the Pushover website, create an application to get a specific API key for the application
  • Download the mobile app and synchronize it with your account
  • Then add this bundle in your composer.json
$ composer require eheuje/pushover-bundle
  • Enable the bundle in your appKernel.php
  • Configure the following parameters in your config.yml with your own values (user_key, api_key and user_email are provided by Pushover once you've create your account and the specific application)
eheuje_pushover:
    application:
        user_key: <your_user_key>
        api_key: <your_api_key>
        user_email: <your_user_email>

Services

To get the service from a controller that says "Hello World" :

$this->get('eheuje_pushover.pusher')
     ->setMessage("Hello World")
     ->push();

Additional information

It's possible to add extra information in your notifications :

  • the duration of a task
  • the memomy used by the task
eheuje_pushover:
    additional_information:
        duration: ~ # true or false
        memory: ~ # true or false

However, this feature is not automatic. It works with the StopWatch Component.

Further information about StopWatch

use Symfony\Component\Stopwatch\Stopwatch;

$stopwatch = new Stopwatch();
$stopwatch->start('eventName');
// ... some code goes here
$event = $stopwatch->stop('eventName');

$this->get('eheuje_pushover.pusher')
     ->setMessage("Hello World")
     ->setStopwatchEvent($event)
     ->push();

PushoverCommand

Further information about the Console Component

When you create huge commands, it takes a lot of time to execute them. If you don't want to wait behind your computer for the commands to terminate, you can create your command as an inheritance of PushoverCommand.

use Eheuje\PushoverBundle\Command\PushoverCommand;
use Symfony\Component\Console\Command\Command;

class GreetCommand extends PushoverCommand
{
// ... some code goes here
}

Then, call the command with the option --with-pushover.

$ php app/console foo:bar "Hello World" --with-pushover

When the command is terminated, you'll be notified if :

  • the command is terminated with a with a awaiting exit code ;
  • the command is terminated with an Exception.

Todolist

  • Do something with the pushover email function
  • Do some tests
  • Clean the bundle

pushoverbundle-1's People

Contributors

jycamier 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.