2017 © Pedro Peláez
 

library pushbullet

Push notifications to devices and browsers via Pushbullet

image

ivkos/pushbullet

Push notifications to devices and browsers via Pushbullet

  • Sunday, May 22, 2016
  • by ivkos
  • Repository
  • 31 Watchers
  • 217 Stars
  • 9,697 Installations
  • PHP
  • 7 Dependents
  • 0 Suggesters
  • 60 Forks
  • 3 Open issues
  • 14 Versions
  • 2 % Grown

The README.md

Pushbullet for PHP

, (*1)

Description

A PHP library for the Pushbullet API allowing you to send all supported push notification types, manage contacts, send SMS messages, create/delete channels, and manage channel subscriptions., (*2)

For more information, you can refer to these links: * Official website: https://www.pushbullet.com * API reference: https://docs.pushbullet.com * Blog: http://blog.pushbullet.com * Apps: https://www.pushbullet.com/apps, (*3)

Requirements

  • PHP 5.4.0 or newer
  • Composer
  • cURL library for PHP
  • Your Pushbullet access token: https://www.pushbullet.com/account

Install

Create a composer.json file in your project root:, (*4)

{
    "require": {
        "ivkos/pushbullet": "3.*"
    }
}

Run php composer.phar install to download the library and its dependencies., (*5)

Quick Documentation

Add this line to include Composer packages:, (*6)

<?php
require 'vendor/autoload.php';

Initialize Pushbullet with your API key:, (*7)

// Get your access token here: https://www.pushbullet.com/account
$pb = new Pushbullet\Pushbullet('YOUR_ACCESS_TOKEN');

If you use PHP for Windows it may be necessary to point cURL to a CA certificate bundle, or disable SSL certificate verification altogether:, (*8)

Pushbullet\Connection::setCurlCallback(function ($curl) {
    // Get a CA certificate bundle here:
    // https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt
    curl_setopt($curl, CURLOPT_CAINFO, 'C:/path/to/ca-bundle.crt');

    // Not recommended! Makes communication vulnerable to MITM attacks:
    // curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
});

Devices

To list all active devices on your account:, (*9)

$pb->getDevices();

Returns an array of Device objects., (*10)


You can target a particular device by using its iden or nickname:, (*11)

$pb->device("Galaxy S4")->getPhonebook();

Returns an array of PhonebookEntry objects with names and phone numbers., (*12)

To target all available devices for pushing:, (*13)

$pb->allDevices()->pushAddress("Google HQ", "1600 Amphitheatre Parkway");

This will send the address to all devices, and return a Push object., (*14)

Push Notifications

You can use push* methods for Contact, Channel and Device objects. Every push* method returns a Push object. If an object cannot be pushed to, a NotPushableException will be thrown., (*15)

Note

Arguments:, (*16)

  • Title
  • Body
$pb->device("Galaxy S4")->pushNote("Hello world!", "Lorem ipsum...");

Arguments:, (*17)

  • Title
  • URL
  • Body
$pb->device("Galaxy S4")->pushLink("ivkos on GitHub", "https://github.com/ivkos", "Look at my page!");

Address

Arguments:, (*18)

  • Name - the place's name.
  • Address - the place's address or a map search query.
$pb->device("Galaxy S4")->pushAddress("Google HQ", "1600 Amphitheatre Parkway");

List

Arguments:, (*19)

  • Title
  • Array of items in the list
$pb->device("Galaxy S4")->pushList("Shopping List", [
    "Milk",
    "Butter",
    "Eggs"
]);

File

Arguments:, (*20)

  • File path
  • MIME type (optional) - if null, MIME type will be magically guessed
  • Title (optional)
  • Body (optional)
  • Alternative file name (optional) - push the file as if it had this file name
$pb->device("Galaxy S4")->pushFile(
    "/home/ivkos/photos/20150314_092653.jpg",
    "image/jpeg",
    "Look at this photo!",
    "I think it's pretty cool",
    "coolphoto.jpg"
);

SMS Messaging

You can send SMS messages only from supported devices. If an attempt is made to send an SMS message from a device doesn't support it, a NoSmsException will be thrown., (*21)

$pb->device("Galaxy S4")->sendSms("+359123", "Hello there!");

Send an SMS text to all people in a device's phonebook:, (*22)

$people = $pb->device("Galaxy S4")->getPhonebook();

foreach ($people as $person) {
    $person->sendSms("Happy New Year!");
}

Channel Management

Get a list of channel subscriptions:, (*23)

$pb->getChannelSubscriptions();

Returns an array of Channel objects with subscription information., (*24)


To subscribe or unsubscribe from channels:, (*25)

$pb->channel("greatchannel")->subscribe();
$pb->channel("mehchannel")->unsubscribe();

Subscribing to a channel will return a Channel object with subscription information., (*26)


Get a list of channels created by the current user:, (*27)

$pb->getMyChannels();

Returns an array of Channel objects., (*28)

Contact Management

Contacts are people you can send push notification to. They are not to be confused with entries in a device's phonebook., (*29)

To list contacts on your account:, (*30)

$pb->getContacts();

Returns an array of Contact objects., (*31)


To create a contact:, (*32)

$pb->createContact("John Doe", "johndoe@example.com");

Returns a Contact object for the newly created contact., (*33)


You can target a particular contact by its email or name:, (*34)

$pb->contact("johndoe@example.com")->pushNote("Hey John!", "Where are you?");

To delete a contact:, (*35)

$pb->contact("Caroline")->delete();

To change a contact's name:, (*36)

$pb->contact("William")->changeName("Bill");

Returns a Contact object with an updated name., (*37)


For more detailed documentation, please refer to the PHPDoc in the source files., (*38)

The Versions

22/05 2016

dev-master

9999999-dev https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • ext-curl *
  • php >= 5.4.0

 

push windows android iphone chrome notifications firefox pushbullet

22/05 2016

3.3.0

3.3.0.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.4.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

20/05 2016

3.2.0

3.2.0.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.4.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

23/05 2015

3.1.2

3.1.2.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.4.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

12/05 2015

3.1.1

3.1.1.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.4.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

04/04 2015

2.x-dev

2.9999999.9999999.9999999-dev https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.3.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

04/04 2015

2.10.1

2.10.1.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.3.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

21/03 2015

3.1.0

3.1.0.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.4.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

09/03 2015

3.0.0

3.0.0.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.4.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

25/02 2015

2.10.0

2.10.0.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.4.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

04/02 2015

2.9.1

2.9.1.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.4.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

04/02 2015

2.8.0

2.8.0.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.4.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

01/02 2015

2.7.2

2.7.2.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.2.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet

26/01 2015

2.7.0

2.7.0.0 https://github.com/ivkos/Pushbullet-for-PHP

Push notifications to devices and browsers via Pushbullet

  Sources   Download

MIT

The Requires

  • php >= 5.2.0
  • ext-curl *

 

push windows android iphone chrome notifications firefox pushbullet