-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.example.php
More file actions
34 lines (27 loc) · 795 Bytes
/
server.example.php
File metadata and controls
34 lines (27 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require __DIR__ . '/vendor/autoload.php';
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use BFoxwell\Votifier\Votifier;
use Psr\Log\LoggerInterface;
// Set Configuration
$config = [
'key' => __DIR__ . '/private.pem', // Required File Path
'passphrase' => '', // Default: empty
'address' => '0.0.0.0', // Default: localhost
'port' => 8192, // Default: 8192
];
// Set Callable Function
$callback = function(array $message, LoggerInterface $log)
{
var_dump($message);
$log->notice('Logging an event.');
};
// Instantiate Votifier Server
$server = new Votifier($config, $callback);
// Setup Logger (Optional)
$logger = new Logger('Votifier');
$logger->pushHandler(new StreamHandler(__DIR__ . '/votifier.log'));
$server->setLogger($logger);
// Start Server
$server->run();