承接 kwarcek/orange-smartsms-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kwarcek/orange-smartsms-api

最新稳定版本:1.0.0

Composer 安装命令:

composer require kwarcek/orange-smartsms-api

包简介

A PHP API client for Orange SmartSMS service.

README 文档

README

A PHP client to interact with the Orange SmartSMS API. This package allows you to send SMS messages, check their delivery status, and monitor API usage limits.

Features

  • Send SMS messages to various networks.
  • Check the delivery status of previously sent SMS messages.
  • Retrieve the usage limit and available requests for the SmartSMS API.

Installation

  1. Install via Composer:

    composer require kwarcek/orange-smartsms-api

Usage

1. Send an SMS Message

You can send an SMS message by using the sendSMS method. The message will be delivered to the recipient's mobile phone.

Example:

use Kwarcek\OrangeSmartsmsApi\Requests\MessagingRequest;
use Kwarcek\OrangeSmartsmsApi\DTO\SMSMessage;
use GuzzleHttp\Client;

$isDev = getenv('APP_ENV');

// Create a new Guzzle client and MessagingRequest instance
$client = new Client([
    'base_uri' => $isDev ? 'https://apib2b-test.orange.pl/' : 'https://apib2b.orange.pl/',
]);
$apiKey = 'your-api-key-here';

$messagingRequest = new MessagingRequest($client, $apiKey);

// Define the SMS message
$message = new SMSMessage([
    'sender' => 'YourSenderID', 
    'recipient' => '48510123456', // Recipient's phone number
    'content' => 'Hello from Orange SmartSMS!',
]);

// Send the SMS
$response = $messagingRequest->sendSMS($message, true);

print_r($response);

2. Check SMS Delivery Status

You can check the delivery status of a sent SMS by passing the unique ID returned in the sendSMS response. Example:

use Kwarcek\OrangeSmartsmsApi\Requests\MessagingRequest;
use GuzzleHttp\Client;

$isDev = getenv('APP_ENV');

$client = new Client([
    'base_uri' => $isDev ? 'https://apib2b-test.orange.pl/' : 'https://apib2b.orange.pl/',
]);
$apiKey = 'your-api-key-here';

$messagingRequest = new MessagingRequest($client, $apiKey);

$id = '54510a5d0361'; // Example message ID
$response = $messagingRequest->checkDeliveryStatus($id);

print_r($response);

3. Check API Usage Limit

You can check the current API usage limit for SmartSMS, including used and available requests. Example:

use Kwarcek\OrangeSmartsmsApi\Requests\MessagingRequest;
use GuzzleHttp\Client;

$isDev = getenv('APP_ENV');

$client = new Client([
    'base_uri' => $isDev ? 'https://apib2b-test.orange.pl/' : 'https://apib2b.orange.pl/',
]);
$apiKey = 'your-api-key-here';

$messagingRequest = new MessagingRequest($client, $apiKey);

$response = $messagingRequest->checkLimit();

print_r($response);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-10-25