Skip to content

Commit 1d54a8e

Browse files
author
Ahmad Samiei
committed
add hangover php port
1 parent 6ec31b4 commit 1d54a8e

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

php/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"require": {
33
"bestnetwork/telnet": "^1.0",
4-
"vlucas/phpdotenv": "^2.0"
4+
"vlucas/phpdotenv": "^2.0",
5+
"twilio/sdk": "^4.6"
56
}
67
}

php/hangover.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
require 'vendor/autoload.php';
5+
6+
(new Dotenv\Dotenv(__DIR__))->load();
7+
(strpos(exec('who'), getenv('USER')) === false) or exit('session found');
8+
9+
$my_number = '+xxx';
10+
$number_of_boss = '+xxx';
11+
$excuse = ['Locked out', 'Pipes broke', 'Food poisoning', 'Not feeling well'];
12+
$excuse = $excuse[array_rand($excuse)];
13+
14+
$twilio = new Services_Twilio(getenv('TWILIO_ACCOUNT_SID'), getenv('TWILIO_AUTH_TOKEN'));
15+
$twilio->account->messages->sendMessage(
16+
$my_number,
17+
$number_of_boss,
18+
"Gonna work from home. {$excuse}"
19+
);
20+
21+
echo "Message sent at: #".date('Y-m-d')." | Excuse: {$excuse}";

0 commit comments

Comments
 (0)