PHP code example of nebo15 / drunken-russian
1. Go to this page and download the library: Download nebo15/drunken-russian library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nebo15 / drunken-russian example snippets
ken = new \Drunken\Manager(
(new MongoClient())->selectDB('db_name')
);
$drunken->add('file', [
'file' => __DIR__ . 'drunken_lines_.txt',
'message' => 'The test line'
]);
namespace Drunken;
class FileWorker extends AbstractWorker
{
public function doThisJob(array $data)
{
$result = file_put_contents($data['file'], sprintf("%s\n", $data['message']), FILE_APPEND);
if ($result !== false) {
return true;
}
return false;
}
}