farzai/truemoney-webhook

1.1.0 2024-05-29 08:41 UTC

This package is auto-updated.

Last update: 2024-09-29 09:17:20 UTC


README

Latest Version on Packagist Tests codecov Total Downloads

感谢 K'DearTanakorn

我们从Repo: DearTanakorn/truemoney-webhook-gateway 进行了Fork

并且可以与PHP服务器一起使用

系统需求

  • PHP 8.0或更高版本

设置

$ composer require farzai/truemoney-webhook

开始使用

use Farzai\TruemoneyWebhook\Postman;

// New instance
$postman = new Postman([
   'secret' => 'your-secret-key',
]);

// Capture all data from incoming request
$data = $postman->capture();

// You can use $data to do anything you want.
// For example, you can get the data as Array
// @returned
// [
//    'event_type' => 'P2P',
//    'received_time' => '2022-01-31T13:02:23+0700',
//    'amount' => 100,
//    'sender_mobile' => '0988882222',
//    'message' => 'ค่าไอเทม',
//    'lat' => 1653538793,
// ]
$data->asArray();

有时,您可能希望从传入请求中获取一些字段。您可以使用$data->field_name来获取该字段的值。

例如

$data->event_type; // string
$data->amount; // int
$data->sender_mobile; // string
$data->message; // string
$data->lat; // int