Added .env

This commit is contained in:
R. Eric Wheeler 2017-08-25 22:40:19 -07:00
parent 7c8e77de98
commit 4c39ba7699
5 changed files with 24 additions and 9 deletions

1
.env.dist Normal file
View File

@ -0,0 +1 @@
NOTI_PB=<pushbullet token>

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
vendor/ vendor/
*~ *~
composer.lock composer.lock
.env

21
app.php
View File

@ -1,15 +1,20 @@
<?php <?php
require 'vendor/autoload.php'; require 'vendor/autoload.php';
$loader = new josegonzalez\Dotenv\Loader(__DIR__.'/.env');
$loader->parse();
$loader->putEnv();
$token = getenv('NOTI_PB'); $token = getenv('PB_TOKEN');
if(empty($token)) { try {
throw new InvalidArgumentException('Please set your Pushbullet API token'); $pushbullet = new Pushbullet\Pushbullet($token);
} catch (\Exception $e) {
print $e->getMessage() . PHP_EOL;
} }
$pb = new Pushbullet\Pushbullet($token);
print_r($pb->getDevices()); $pushResult = $pushbullet
->device('Google Pixel XL')
//$pb->device('Chrome')->pushNote('Done', 'Your thing has finished on repos.'); ->pushNote('Hello!', 'How are you?')
$pb->device('Huawei Nexus 6P')->pushNote('Done', 'Finished pushing'); ;
print_r($pushResult);

0
bin/pushbullet Executable file
View File

View File

@ -1,10 +1,18 @@
{ {
"name": "sikofitt/pushbullet-notifier",
"description": "Simple php app to alert you after jobs are done",
"license": "GPL-3.0",
"autoload": {
"psr-4": {
"Sikofitt\\Pushbullet\\": "src/Sikofitt/Pushbullet/"
}
},
"require": { "require": {
"php": ">=7.1", "php": ">=7.1",
"ivkos/pushbullet": "^3.1", "ivkos/pushbullet": "^3.1",
"symfony/console": "^3.2", "symfony/console": "^3.2",
"symfony/event-dispatcher": "^3.2", "symfony/event-dispatcher": "^3.2",
"symfony/config": "^3.2", "symfony/config": "^3.2",
"symfony/dotenv": "dev-master" "josegonzalez/dotenv": "^3.1"
} }
} }