PHP aws sqs wrapper.

0.0.4 2022-04-18 13:41 UTC

This package is auto-updated.

Last update: 2024-05-18 17:57:09 UTC


README

contributions welcome Latest Stable Version Total Downloads License

Installation

Aws Sqs Wrapper installation is very simple. Open the terminal and run this command

composer require bariseser/sqs

Consume Message

$consumer = (new SqsConsumer())
    ->setQueueUrl("http://localhost:4566/000000000000/client_api.fifo");

while (true) {
    $messages = $consumer->messages();
    if (!empty($messages->get('Messages'))) {
        foreach ($messages->get('Messages') as $message) {
            echo $message['Body'].PHP_EOL;
        }
    } else {
        echo "No messages in queue". PHP_EOL;
    }
}

Produce Message

$producer = (new SqsConsumer())
    ->setQueueUrl("http://localhost:4566/000000000000/client_api.fifo");
$producer->setMessageBody(json_encode(['title' => "baris eser", 'id' => 12345]))->publish();

Getting help / Contact

Contributing

1 - Fork the Project

2 - Ensure you have Composer installed (see Composer Download Instructions)

3 - Install Development Dependencies

composer install

4 - Run the Test Suite

vendor/bin/phpunit

5 - Send us a Pull Request