承接 nextsms/php-client 相关项目开发

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

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

nextsms/php-client

Composer 安装命令:

composer require nextsms/php-client

包简介

Nextsms for PHP

README 文档

README

Latest Version on Packagist Tests Total Downloads Check & fix styling

The Nextsms for PHP makes it easy for developers to access Nextsms services in their PHP code, and build robust applications and software using services like Bulk SMS delivery, Sub customers, and more.

V2: You are currently viewing the documentation for the NextSMS PHP SDK V2. If you are looking for the documentation for the V1 SDK, you can find it here.

Installation

Requirement: PHP 8.0 or higher is required.

You can install the package via Composer:

composer require nextsms/php-client

Usage

require 'vendor/autoload.php';

use Nextsms\Nextsms;

$client = Nextsms::create(
    username: 'YOUR_USERNAME',
    password:  'YOUR_PASSWORD',
    from: 'NEXTSMS'
);

$helloMessage = $client->messages()->send([
    "to": '2557123456789',
    "text": 'Hello World', 
    // from is optional if you have set it in the constructor
]);
// Or
$message = Message::create(text: 'Hello World',to: '2557123456789');

$helloMessage = $client->messages()->send($message);

// Send Later
$messageScheduled = $client->messages()->sendLater(
    new Message(to: '2557123456789', text: 'Hello World'), 
    \DateTime::createFromFormat('Y-m-d', '2020-12-31')
);

// Send to many
$manyMessages = $client->messages()->sendMany(
    MessageCollection::create([
        Message::text(to: '2557123456789', text: 'Hello World'),
        Message::text(to: '2557123456789', text: 'Hello World'),
    ])
);
// Or
$manyMessages = $client->messages()->sendMany(
    MessageCollection::create([
        Message::text(to: '2557123456789', text: 'Hello World'),
        Message::text(to: [ '2557123456789', '2557123456789' ], text: 'Hello World'),
    ]);    
);

// Delivery reports
$allReports = $client->reports()->all();

// Query
$reports = $client->reports()
    ->query()
    // Using date string
    ->sentFrom(date: '01-01-2022')
    // Or using date object
    ->sentUntil(date: \DateTime::create('now'))
    ->get();

$report = $client->reports()->get($messageId);
// 

// Customer
$customer = Customer::create([
    "first_name" => "Api",
    "last_name" => "Customer",
    "username" => "api_customer",
    "email" => "apicust@customer.com",
    "phone_number" => "0738234339",
    "account_type" => "Sub Customer (Reseller)", 
    "sms_price" => 200
]);

// Create
$customer = $client->customers()->create($customer);

// Recharge
$recharge = $client->customers()->recharge($customer, 1000);

// Deduct
$deduct = $client->customers()->deduct($customer, 1100);

Testing

Using Pest framework.

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Star this repository

If you enjoy this package, please star this repository to encourage further development.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固