承接 heyjorgedev/qstash-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

heyjorgedev/qstash-php

Composer 安装命令:

composer require heyjorgedev/qstash-php

包简介

QStash SDK for PHP - QStash is an HTTP based messaging and scheduling solution for serverless and edge runtimes

README 文档

README

This project is still in early stages of development. I am still writing most of the API endpoints and the API is under constant change so I do not recommend to use it on production yet.

QStash Client SDK for PHP

Latest Version on Packagist Tests Total Downloads

QStash is an HTTP based messaging and scheduling solution for serverless and edge runtimes.

How does QStash work?

QStash is the message broker between your serverless apps. You send an HTTP request to QStash, that includes a destination, a payload and optional settings. We durably store your message and will deliver it to the destination API via HTTP. In case the destination is not ready to receive the message, we will retry the message later, to guarantee at-least-once delivery.

Installation

You can install the package via composer:

composer require heyjorgedev/qstash-php

Get your authorization token

Go to Upstash Console and copy the QSTASH_TOKEN.

Basic Usage

use HeyJorgeDev\QStash\QStash;
use HeyJorgeDev\QStash\ValueObjects\Message;
use HeyJorgeDev\QStash\ValueObjects\Url;

$client = QStash::client('QSTASH_TOKEN');

$message = $client->publish(
    Message::to(new Url('https://my-api...'))
        ->withBody([
            'hello' => 'world',
        ])
]);

// to know if the request was successful:
echo $message->isSuccessful()

// to get the message
echo $message->getData();

// to get the message id
echo $message->getData()->id;

Receiver

When receiving a message from QStash, you should verify the signature. We have a class to help you with that:

use HeyJorgeDev\QStash\QStash;

$receiver = QStash::receiver([
    'QSTASH_CURRENT_SIGNING_KEY',
    'QSTASH_NEXT_SIGNING_KEY',
]);

$result = $receiver->verify(
    body: $request->getBody(),
    signature: $request->getHeader('Upstash-Signature'),
    url: $request->getUri(),
);

echo $result; // true or false

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-13