Add bfoxwell/votifier
to composer.json
.
"bfoxwell/votifier": "dev-master"
Run composer update
to pull down the latest version of the Votifier Server.
Generate Keys
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout > public.pem
$config = [
'key' => __DIR__ . '/private.pem', // Required | /path/to/private-key.pem
'passphrase' => '', // Optional
'address' => '0.0.0.0', // Optional | Default: localhost
'port' => 8192, // Optional | Default: 8192
];
// $message returns array | $logger returns instance of Psr\Log\LoggerInterface;
$server = new Votifier($config, function($message, $logger)
{
// Your code goes here
});
Message Returns
array(4) {
'serviceName' =>
string(5) "MinecraftVoteSite"
'username' =>
string(5) "Steve"
'address' =>
string(9) "example.com"
'timeStamp' =>
string(10) "1400647120"
}
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
// create a log channel
$logger = new Logger('Votifier');
$logger->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
$server->setLogger($logger); // Set Logger
$server->run();
[program:votifier_vanilla]
command=php index.php vanilla
directory=/home/minecraft/http/viper-votifier
stdout_logfile=/home/minecraft/http/api/app/storage/logs/votifier_vanilla_supervisord.log
redirect_stderr=true