Package Data | |
---|---|
Maintainer Username: | rpsimao |
Maintainer Contact: | ricardo.simao@upgrade.pt (Ricardo Simão) |
Package Create Date: | 2017-07-03 |
Package Last Update: | 2017-07-03 |
Home Page: | http://lahaxearnaud.github.io/laravel-pushbullet |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-15 15:07:11 |
Package Statistics | |
---|---|
Total Downloads: | 77 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Fork of https://github.com/lahaxearnaud/laravel-pushbullet
This package is an integration of joetannenbaum/phpushbullet
library in Laravel 5.
{
"require": {
"rpsimao/laravel-pushbullet": "~2.0"
}
}
Add provider in your app.php
'providers' => array(
//...
rpsimao\LaravelPushbullet\LaravelPushbulletServiceProvider::class,
),
Add facade in your app.php
'aliases' => array(
//...
'PushBullet' => rpsimao\LaravelPushbullet\LaravelPushbulletFacade::class,
),
Set the api key in config/services.php
'pushbullet' => [
'apiKey' => 'MY-APPI-KEY',
],
If you do not wish to put your access token in your code (understandable), simply set it to the environment variable named pushbullet.access_token
and set:
'apiKey' => $_ENV['pushbullet.access_token']
To list the available devices on your account:
PushBullet::devices();
This will return an array of objects with all of the device information.
When pushing a to a device, simply use the device's nickname
or their iden
from the list above.
To push to a single device:
PushBullet::device('Chrome')->note('Remember', 'Buy some eggs.');
To push to multiple devices:
PushBullet::device('Chrome')->device('Galaxy S4')->note('Remember', 'Buy some eggs.');
// or
PushBullet::device('Chrome', 'Galaxy S4')->note('Remember', 'Buy some eggs.');
// or using an array
PushBullet::device(['Chrome', 'Galaxy S4'])->note('Remember', 'Buy some eggs.');
// or using a collection
PushBullet::device(Device::all()->pluck('name'))->note('Remember', 'Buy some eggs.');
If you want to push to all devices
PushBullet::all()->note('Remember', 'Buy some eggs.');
You can select a type of device (ex android)
PushBullet::type('android')->note('Remember', 'Buy some eggs.');
// or
PushBullet::type('android')->type('chrome')->note('Remember', 'Buy some eggs.');
// or
PushBullet::type('android', 'chrome')->note('Remember', 'Buy some eggs.');
// or using an array
PushBullet::type(['android', 'chrome'])->note('Remember', 'Buy some eggs.');
// or using a collection
PushBullet::type(Type::all()->pluck('name'))->note('Remember', 'Buy some eggs.');
When pushing a to a user, simply use the user's email address:
To push to a single user:
PushBullet::user('joe@example.com')->note('Remember', 'Buy some eggs.');
To push to multiple users:
PushBullet::user('joe@example.com')->user('anne@example.com')->note('Remember', 'Buy some eggs.');
// or
PushBullet::user('joe@example.com', 'anne@example.com')->note('Remember', 'Buy some eggs.');
// or using an array
PushBullet::user(['joe@example.com', 'anne@example.com'])->note('Remember', 'Buy some eggs.');
// or using a collection
PushBullet::user(User::findMany([1, 2, 3])->pluck('email'))->note('Remember', 'Buy some eggs.');
Arguments:
PushBullet::device('Chrome')->note('Musings', 'Why are fudgy brownies better than cakey brownies?');
Arguments:
PushBullet::device('Chrome')->link('Look It Up', 'http://google.com', 'I hear this is a good site for finding things.');
Arguments:
PushBullet::device('Chrome')->address('The Hollywood Sign', '4059 Mt Lee Drive Hollywood, CA 90068');
Alternatively, you can pass in an associative array:
$address = [
'address' => '4059 Mt Lee Drive',
'city' => 'Hollywood',
'state' => 'CA',
'zip' => '90068',
];
PushBullet::device('Chrome')->address('The Hollywood Sign', $address);
Arguments:
$items = [
'Socks',
'Pants',
'Keys',
'Wallet',
];
PushBullet::device('Chrome')->list('Do Not Forget', $items);
Arguments:
PushBullet::device('Chrome')->file('The Big Presentation', 'http://example.com/do-not-lose-this.pptx', 'Final version of slides.');