https://github.com/lahaxearnaud/laravel-pushbullet
PushBullet for Laravel
https://github.com/lahaxearnaud/laravel-pushbullet
laravel php pushbullet
Last synced: about 1 year ago
JSON representation
PushBullet for Laravel
- Host: GitHub
- URL: https://github.com/lahaxearnaud/laravel-pushbullet
- Owner: lahaxearnaud
- License: mit
- Created: 2014-12-12T13:46:31.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T05:55:11.000Z (over 2 years ago)
- Last Synced: 2024-03-15T09:07:52.820Z (about 2 years ago)
- Topics: laravel, php, pushbullet
- Language: PHP
- Homepage: http://lahaxearnaud.github.io/laravel-pushbullet
- Size: 115 KB
- Stars: 16
- Watchers: 3
- Forks: 8
- Open Issues: 7
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Laravel-PushBullet
This package is an integration of `joetannenbaum/phpushbullet` library in Laravel.
## Table of Contents
+ [Installation](#installation)
+ [Listing Devices](#listing-devices)
+ [Pushing](#pushing)
+ [To Devices](#to-devices)
+ [To Type of evices](#to-type)
+ [To Users](#to-users)
+ [Types](#types)
+ [Notes](#notes)
+ [Links](#links)
+ [Addresses](#addresses)
+ [Lists](#lists)
+ [Files](#files)
## Installation
```
$ composer require lahaxearnaud/laravel-pushbullet
```
That's all !
Just don't forget to use the face before using it:
```
use Lahaxearnaud\LaravelPushbullet\Pushbullet;
```
## Listing Devices
To list the available devices on your account:
```php
PushBullet::devices();
```
This will return an array of objects with all of the device information.
## Pushing
### To Devices
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:
```php
PushBullet::device('Chrome')->note('Remember', 'Buy some eggs.');
```
To push to multiple devices:
```php
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
```php
PushBullet::all()->note('Remember', 'Buy some eggs.');
```
### To Type
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.');
```
### To Users
When pushing a to a user, simply use the user's email address:
To push to a single user:
```php
PushBullet::user('joe@example.com')->note('Remember', 'Buy some eggs.');
```
To push to multiple users:
```php
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.');
```
## Types
### Notes
Arguments:
+ Title
+ Body
```php
PushBullet::device('Chrome')->note('Musings', 'Why are fudgy brownies better than cakey brownies?');
```
### Links
Arguments:
+ Title
+ URL
+ Body (optional)
```php
PushBullet::device('Chrome')->link('Look It Up', 'http://google.com', 'I hear this is a good site for finding things.');
```
### Addresses
Arguments:
+ Name
+ Address
```php
PushBullet::device('Chrome')->address('The Hollywood Sign', '4059 Mt Lee Drive Hollywood, CA 90068');
```
Alternatively, you can pass in an associative array:
```php
$address = [
'address' => '4059 Mt Lee Drive',
'city' => 'Hollywood',
'state' => 'CA',
'zip' => '90068',
];
PushBullet::device('Chrome')->address('The Hollywood Sign', $address);
```
### Lists
Arguments:
+ Title
+ Items (array)
```php
$items = [
'Socks',
'Pants',
'Keys',
'Wallet',
];
PushBullet::device('Chrome')->list('Do Not Forget', $items);
```
### Files
Arguments:
+ File Name
+ File URL (must be publicly available)
+ Body (optional)
```php
PushBullet::device('Chrome')->file('The Big Presentation', 'http://example.com/do-not-lose-this.pptx', 'Final version of slides.');
```