定制 dexalt142/sendtalk 二次开发

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

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

dexalt142/sendtalk

最新稳定版本:1.2

Composer 安装命令:

composer require dexalt142/sendtalk

包简介

Unofficial TapTalk's SendTalk library for Laravel.

README 文档

README

Unofficial TapTalk's SendTalk library for Laravel.

PHPUnit Tests Latest Version Packagist Downloads License

1. Installation

You can install this package through Composer CLI by running this command.

composer require dexalt142/sendtalk

Or you can modify the composer.json file and don't forget to run composer install.

{
    "require": {
        "dexalt142/sendtalk": "1.*"
    }
}

2. Configuration

Before using this package, you need to set your SendTalk API key, you can do this by adding SENDTALK_API_KEY to the .env file.

APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

SENDTALK_API_KEY=YOUR_SENDTALK_API_KEY_HERE

...

3. How to Use

To call all available methods, you must call it through the SendTalk Facade Dexalt142\SendTalk\Facades\SendTalk.

3.a. Get message status

<?php

namespace App\Http\Controllers;

use Dexalt142\SendTalk\Facades\SendTalk;

class MessageController {

    public function getMessage() {
        // SendTalk::getMessageStatus($id)
        $message = SendTalk::getMessageStatus('f26ccf7a-d867-b3a4-d333-117ec668718d');
    }

}

If the message is exists, the method above will return a result like this example below, otherwise it will throw an exception.

{
    "status": "read",
    "isPending": false,
    "isSent": true,
    "sentTime": 1653924408488,
    "currency": "IDR",
    "price": 75,
    "createdTime": 1653924407993
}

3.b. Send message

<?php

namespace App\Http\Controllers;

use Dexalt142\SendTalk\Facades\SendTalk;

class MessageController {

    public function sendMessage() {

        // SendTalk::sendTextMessage($phoneNumber, $content)
        $textMessage = SendTalk::sendTextMessage('+6281234567890', 'Foo Bar');

        // SendTalk::sendImageMessage($phoneNumber, $imageUrl, $fileName, $caption = null)
        $imageMessage = SendTalk::sendImageMessage('+6281234567890', 'https://example.com/foobar.png', 'foobar.png', 'Foo Bar');

        // SendTalk::sendOTPMessage($phoneNumber, $content)
        $otpMessage = SendTalk::sendOTPMessage('+6281234567890', 'Foo Bar');
    }

}

If the request was sent, the method above will return the id of the message, otherwise it will throw an exception.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固