goxens/goxens-v2-php

Goxens v2 PHP SDK

v1.0.5 2023-02-06 19:33 UTC

This package is auto-updated.

Last update: 2024-09-06 23:00:45 UTC


README

使用 GoxensV2Php 库,您可以通过 Goxens API V2 使用 Goxens 服务。

安装

composer require goxenspro/goxens-v2-php

使用

要使用 Goxens V2 PHP SDK,您需要一个 API 密钥或 JWT 令牌。您可以从 Goxens 控制面板中获取 API 密钥,或者使用 Auth 类通过您的电子邮件和密码生成 JWT 令牌。

require_once __DIR__ . '/vendor/autoload.php';

生成 Bearer 认证令牌

$auth = new Goxens\GoxensV2Php\Auth();
$jwt = $auth->generateToken('your@email.com', 'yourpassword');

余额

要检查您的余额,您需要向以下 URL 发送 GET 请求

您可以选择使用您的认证令牌或 API 密钥。

$balance = new Goxens\GoxensV2Php\Balance();
$balance->getBalance($jwt); // ou $balance->getBalance($apiKey);

快递商

创建快递商

您可以选择使用您的认证令牌或 API 密钥。

    $sender = new Goxens\GoxensV2Php\Sender();
    $senderName = $sender->createSender('My Sender', $token);

获取快递商列表

    $sender = new Goxens\GoxensV2Php\Sender();
    $senderList = $sender->findSenders($token);

删除快递商

    $sender = new Goxens\GoxensV2Php\Sender();
    $sender->deleteSender($senderId, $token);

发送短信

要发送短信,您需要向以下 URL 发送 POST 请求

您可以选择使用您的认证令牌或 API 密钥。

    // Pour générer un jeton d'authentification
    $auth = new Goxens\GoxensV2Php\Auth();
    $token = $auth->generateToken('your@email.com', 'yourpassword');
 
    
    // Pour envoyer un SMS
    $simplesend = new Goxens\GoxensV2Php\Simplesend();
    $data = [
        "sender" => "My Sender",
        "typeContact" => "compose",
        "listeContacts" => "22991107506",
        "message" => "Bonjour",
        "hasSchedule" => false,
        "programDate" => null,
        "programTime" => null,
        "typeSmsSend" => "standard"
    ];
   
    $sendResult = $simplesend->sendSimpleSend($data, $token);