evp/gsms-bundle

此包的最新版本(1.1.1)没有可用的许可证信息。

Symfony 包,用于提供 gsms.lt 服务

1.1.1 2024-03-12 09:23 UTC

This package is not auto-updated.

Last update: 2024-09-24 12:44:16 UTC


README

什么是 GsmsBundle?

GsmsBundle 是一个小型包,可以作为您 Symphony 框架和 GsmsPHPClient 之间的桥梁

部分

需求

  • 一个活跃的 gsms.lt 账户

安装

  • Composer
   composer require evp/gsms-bundle
  • 在内核中启用该包
<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        //... your existing bundles here
        new Evp\Bundle\GsmsBundle\EvpGsmsBundle(),
    );
}
  • 配置您的 app/config/config.yml
evp_gsms:
  credentials:
    username: your_username
    password: your_password
  from: my_phone_number
  callback_uri: "http://example.com/callback"

不要忘记将 your_usernameyour_password 等其他参数替换为实际值。fromcallback_uri 参数是可选的。

就这样,现在您已经准备好使用 GsmsBundle。

代码示例

一旦安装了该包,依赖容器将包含 evp_gsms.client 服务,可以用来访问 GsmsPHPClient 的方法

使用客户端发送您的第一条短信

$response = $client->send('Your telephone number', 'Receiver telephone number', 'message');

并从服务器获取响应

if ($response->isSuccessful()) {
   // Do something when the sms has been sent
} else {
   // Do something when the sms has not been sent
   $lastResponse = $client->getLastResponse();
}

请参阅 Evp_Gsms_Client 文档 获取更多信息。

联系

如果您有任何其他问题,请随时联系我们

"Paysera LT",UAB
Pilaitės pr. 16 LT-04352 Vilnius
电子邮件: pagalba@gsms.lt
电话 +370 (5) 2 03 27 19
传真 +370 (5) 2 63 91 79