
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
0100dev/cakephp-rabbitmq
Advanced tools
RabbitMQ plugin for CakePHP 3.
Use this plugin to drastically reduce page load times by offloading time consuming processes (like sending emails and resizing uploaded images) to a CLI consumer using messages in RabbitMQ. Could also be used to communicate with other systems or, for example, log lintes.
Install the plugin using Composer:
composer require 0100dev/cakephp-rabbitmq
Now load the plugin by either running this shell command:
bin/cake plugin load DevApp/RabbitMQ --bootstrap
or by manually adding the following line to config/bootstrap.php:
Plugin::load('DevApp/RabbitMQ', ['bootstrap' => true]);
Lastly, add a new Gearman configuration section to (most likely) app.php:
'Gearman' => [
'Servers' => [
'127.0.0.1:4730'
],
'Jobs' => [
]
]
Before proceeding you might want to verify that the Gearman Job Server is actually up and running on your local system.
On Ubuntu systems running sudo netstat -peanut | grep gearman should
produce something similar to:
tcp 0 0 127.0.0.1:4730 0.0.0.0:* LISTEN 0 9727 625/gearmand
tcp6 0 0 ::1:4730 :::* LISTEN 0 9726 625/gearmand
Using this plugin comes down to:
WorkerShell on your local systemexecute()
function found in the JobAwareTraitTo start the WorkerShell so it will listen for incoming tasks run the
following command on your local system:
bin/cake consumer
This plugin comes with a built-in email task that allows you to start offloading emails using the worker instantly.
To enable the email task first add the following job to your Gearman configuration section:
'Jobs' => [
'className' => 'Email'
]
Then add the following worker configuration to your existing EmailTransporter
configuration section (most likely found in app.php):
'worker' => [
'className' => 'CvoTechnologies/Gearman.Worker',
'transport' => 'default',
'background' => true
]
Now all you need to do is use this EmailTransporter in your application
when sending emails and it will automatically offload all email sending to the
built-in task using the EmailTransporter defined in the transport key. E.g.
$email = new Email('default');
$res = $email->from(['you@example.com' => 'Your Site'])
->to('recipient@sexample.com')
->subject('Testing cakephp-gearman built-in EmailTask')
->send('Your message');
If things went well you should see the worker providing feedback on tasks being processed shown below:

As an example we will create the following SleepTask that:
src/Shell/Task/SleepTask.phpmain() function<?php
namespace CvoTechnologies\Gearman\Shell\Task;
use Cake\Console\Shell;
class SleepTask extends Shell
{
public function main($workload, GearmanJob $job)
{
$job->sendStatus(0, 3);
sleep($workload['timeout']);
$job->sendStatus(1, 3);
sleep($workload['timeout']);
$job->sendStatus(2, 3);
sleep($workload['timeout']);
return array(
'total_timeout' => $workload['timeout'] * 3
);
}
}
Please note that the plugin will take care of arrays and objects. When you submit an array in the task, you will receive an array in the workload.
To start using the task:
JobAwareTrait in your application code$this->execute function to pass the job to GearmanPlease note that the execute() method takes the following parameters:
$name: name of the job (task in cakephp)$workload: mixed, can be either an array, string, int or everything else$background: boolean, true to run in background$priority: Gearman::PRIORITY_NORMAL, _LOW, _NORMAL or _HIGHBefore submitting a PR please make sure that:
FAQs
A RabbitMQ plugin for CakePHP 3
We found that 0100dev/cakephp-rabbitmq demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.