mrehman23/aws-sqs 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrehman23/aws-sqs

最新稳定版本:0.0.6

Composer 安装命令:

composer require mrehman23/aws-sqs

包简介

PHP package for interacting with Amazon Simple Queue Service (SQS)

README 文档

README

License

This package provides a simple and convenient way to interact with Amazon Simple Queue Service (SQS) using PHP.

Features

  • Send messages to an SQS queue.
  • Receive messages from an SQS queue.
  • Delete messages from an SQS queue.

Requirements

  • PHP 7.2 or later
  • AWS SDK for PHP (aws/aws-sdk-php)
  • AWS account credentials set up (Access Key ID and Secret Access Key)

Installation

You can install this package via Composer:

composer require mrehman23/aws-sqs

Examples

require 'vendor/autoload.php';
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);

Listener

require 'vendor/autoload.php';
use AwsSqs\SqsWorker;

$worker = new SqsWorker($this->awsConfig['credentials']);
$worker->listen(
    $this->awsConfig['queue'],
    [$this, 'processMessage'],
    [$this, 'errorHandler']
);


统计信息

  • 总下载量: 2.54k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-14