定制 frain/convoy 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

frain/convoy

最新稳定版本:v1.0.1

Composer 安装命令:

composer require frain/convoy

包简介

Convoy PHP SDK Library

README 文档

README

Latest Version on Packagist Total Downloads

This is the Convoy PHP SDK. This SDK contains methods for easily interacting with Convoy's API. Below are examples to get you started. For additional examples, please see our official documentation at (https://convoy.readme.io/reference)

Installation

To install the package, you will need to be using Composer in your project.

The Convoy PHP SDK is not hard coupled to any HTTP Client such as Guzzle or any other library used to make HTTP requests. The HTTP Client implementation is based on PSR-18. This provides you with the convenience of choosing what PSR-7 and HTTP Client you want to use.

To get started quickly,

composer require frain/convoy symfony/http-client nyholm/psr7

Setup Client

Next, import the convoy module and setup with your auth credentials.

use Convoy\Convoy;

$convoy = new Convoy(["api_key" => "your_api_key", "project_id" => "your_project_id"]);

Create an Endpoint

An endpoint represents a target URL to receive events.

$endpointData = [
    "name" => "Default Endpoint",
    "url" => "https://0d87-102-89-2-172.ngrok.io",
    "description" => "Default Endpoint",
    "secret" => "endpoint-secret",
    "events" => ["*"]
];

$response = $convoy->endpoints()->create($endpointData);

Update an Endpoint

$endpointId = "01GTVFSGBAH8NJTMT5Y1ENE218";

$endpointData = [
    "name" => "Default Endpoint",
    "url" => "https://0d87-102-89-2-172.ngrok.io",
    "description" => "Default Endpoint",
    "secret" => "endpoint-secret",
    "events" => ["*"]
];

$response = $convoy->endpoints()->update($endpointId, $endpointData);

Sending an Event

To send an event, you'll need the uid from the endpoint we created earlier.

$eventData = [
    "endpoint_id" => $endpointId,
    "event_type" => "payment.success",
    "data" => [
        "event" => "payment.success",
        "data" => [
            "status" => "Completed",
            "description" => "Transaction Successful",
            "userID" => "test_user_id808"
        ]
    ]
];

$response = $convoy->events()->create($eventData);

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固