1. Go to this page and download the library: Download mrehman23/aws-sqs 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/ */
mrehman23 / aws-sqs example snippets
use AwsSqs\SqsMessenger;
$AwsConfig = [
'AWS_KEY'=>'', //You should put your AWS_KEY
'AWS_SECRET_KEY'=>'', //You should put your AWS_SECRET_KEY
'AWS_REGION'=>'eu-west-1', //You should put your AWS_REGION
'API_VERSION'=>'2012-11-05'
];
$messenger = new SqsMessenger($AwsConfig);
// $messenger->RetryTimesOnFail = 2;
// $messenger->WaitBeforeRetry = 1; //seconds
$queue = "<Your queueUrl>";
$message = "This is a message for SQS";
$messageAttributes['params'] = [
'DataType' => 'String',
'StringValue' => json_encode($params)
];
$delaySeconds = 10;
$messageGroupId = '';
$messageDeduplicationId = '';
$result = $messenger->publish($queue, $message, $messageAttributes, $delaySeconds, $messageGroupId, $messageDeduplicationId);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.