Added .env
This commit is contained in:
parent
7c8e77de98
commit
4c39ba7699
|
@ -2,3 +2,4 @@
|
||||||
vendor/
|
vendor/
|
||||||
*~
|
*~
|
||||||
composer.lock
|
composer.lock
|
||||||
|
.env
|
||||||
|
|
21
app.php
21
app.php
|
@ -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);
|
|
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue