PHP code example of adamhutchison / laravel-mq-manager
1. Go to this page and download the library: Download adamhutchison/laravel-mq-manager 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/ */
adamhutchison / laravel-mq-manager example snippets
// Sends message 'Hello world to the queue deined by MQ_MANAGER_QUEUE env value
app(MQManager::class)->sendMessage('Hello World');
// Sends message to a custom queue
app(MQManager::class)->sendMessage('Hello World', 'some_custom_queue');
// Listen for messages on queues defined in mqconfig.subscribed_queues array
app(MQManager::class)->listen();
// listen for messages sent to a custom queue and handle using a callback
app(MQManager::class)->listen('custom_queue', function($message){
echo $message->body;
});
namespace App;
use Illuminate\Database\Eloquent\Model;
use MQManager\ModelTraits\ModelTraits\SendsMQMessages;
class Job extends Model
{
use SendsMQMessages;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.