Поставить в очередь
handle(new BusQue\QueuedCommand($command));
// or
$busQue->queueCommand($command);
Выполнение
workQueue('default'); // Hello Joe!
Выполнение по расписанию в очередь ставим
handle(new BusQue\ScheduledCommand($command, new \DateTime('+1 minute')));
// or
$busQue->scheduleCommand($command, new \DateTime('+1 minute'));
https://github.com/mgdigital/busque
https://github.com/ianstormtaylor/slate
Поддерживает: Beanstalkd Backend, Pdo Backend, RabbitMq Backend, Redis Backend, SQS Backend
Пример для Beanstalkd
Добавить в очередь
use Da\Mailer\Model\MailMessage;
use Da\Mailer\Queue\MailQueue;
use Da\Mailer\Queue\Backend\Beanstalkd\BeanstalkdMailJob;
use Da\Mailer\Queue\Backend\Beanstalkd\BeanstalkdQueueStoreAdapter;
use Da\Mailer\Queue\Backend\Beanstalkd\BeanstalkdQueueStoreConnection;
use PDO;
$message = new MailMessage([
'from' => '[email protected]',
'to' => '[email protected]',
'subject' => 'What is up?',
]);
$conn = new BeanstalkdQueueStoreConnection([
'host' => 'localhost',
'port' => 'root']);
$adapter = new BeanstalkdQueueStoreAdapter($conn);
$queue = new MailQueue($adapter);
$job = new BeanstalkdMailJob([
'message' => json_encode($message),
]);
if (!$queue->enqueue($job)) {
// ... queue operation failed
}
Забираем из очереди
use Da\Mailer\Queue\MailQueue;
use Da\Mailer\Queue\Backend\Beanstalkd\BeanstalkdQueueStoreAdapter;
use Da\Mailer\Queue\Backend\Beanstalkd\BeanstalkdQueueStoreConnection;
$conn = new BeanstalkdQueueStoreConnection([
'connectionString' => 'mysql:host=localhost;dbname=test',
'username' => 'root',
'password' => 'password'
], [PDO::ATTR_PERSISTENT => true]);
$adapter = new BeanstalkdQueueStoreAdapter($conn);
$queue = new MailQueue($adapter);
if (($job = $queue->dequeue()) !== null) {
// ... do something with received job
// ... send it using `mail()` function for example
// ... or by using MailMessageWorker
$job->markAsCompleted();
$queue->ack($job);
}
https://github.com/2amigos/mailer-library
use Spatie\Regex\Regex;
// Using `match`
Regex::match('/a/', 'abc'); // `MatchResult` object
Regex::match('/a/', 'abc')->hasMatch(); // true
Regex::match('/a/', 'abc')->result(); // 'a'
// Capturing groups with `match`
Regex::match('/a(b)/', 'abc')->result(); // 'ab'
Regex::match('/a(b)/', 'abc')->group(1); // 'a'
// Using `matchAll`
Regex::matchAll('/a/', 'abcabc')->hasMatch(); // true
Regex::matchAll('/a/', 'abcabc')->results(); // Array of `MatchResult` objects
// Using replace
Regex::replace('/a/', 'b', 'abc')->result(); // 'bbc';
Regex::replace('/a/', function (MatchResult $result) {
return $result->result() . 'Hello!';
}, 'abc')->result(); // 'aHello!bc';
https://github.com/spatie/regex
https://github.com/asmblah/uniter
inView('.someSelector')
.on('enter', doSomething)
.on('exit', el => {
el.style.opacity = 0.5;
});
https://github.com/camwiegert/in-view