From 4c39ba76993e41e6e2633ef09a1b26e0eb109c66 Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Fri, 25 Aug 2017 22:40:19 -0700 Subject: [PATCH] Added .env --- .env.dist | 1 + .gitignore | 1 + app.php | 21 +++++++++++++-------- bin/pushbullet | 0 composer.json | 10 +++++++++- 5 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 .env.dist create mode 100755 bin/pushbullet diff --git a/.env.dist b/.env.dist new file mode 100644 index 0000000..5fbe054 --- /dev/null +++ b/.env.dist @@ -0,0 +1 @@ +NOTI_PB= diff --git a/.gitignore b/.gitignore index 2d67556..eeec2f3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ vendor/ *~ composer.lock +.env diff --git a/app.php b/app.php index 2c6836d..5494850 100644 --- a/app.php +++ b/app.php @@ -1,15 +1,20 @@ parse(); +$loader->putEnv(); -$token = getenv('NOTI_PB'); +$token = getenv('PB_TOKEN'); -if(empty($token)) { - throw new InvalidArgumentException('Please set your Pushbullet API token'); +try { + $pushbullet = new Pushbullet\Pushbullet($token); +} catch (\Exception $e) { + print $e->getMessage() . PHP_EOL; } -$pb = new Pushbullet\Pushbullet($token); -print_r($pb->getDevices()); - -//$pb->device('Chrome')->pushNote('Done', 'Your thing has finished on repos.'); -$pb->device('Huawei Nexus 6P')->pushNote('Done', 'Finished pushing'); +$pushResult = $pushbullet + ->device('Google Pixel XL') + ->pushNote('Hello!', 'How are you?') + ; +print_r($pushResult); \ No newline at end of file diff --git a/bin/pushbullet b/bin/pushbullet new file mode 100755 index 0000000..e69de29 diff --git a/composer.json b/composer.json index ff8a4f4..8a36acf 100644 --- a/composer.json +++ b/composer.json @@ -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": { "php": ">=7.1", "ivkos/pushbullet": "^3.1", "symfony/console": "^3.2", "symfony/event-dispatcher": "^3.2", "symfony/config": "^3.2", - "symfony/dotenv": "dev-master" + "josegonzalez/dotenv": "^3.1" } }