AliSMS
是一个基于vapor4的阿里云短信服务框架。支持 macOS, Ubuntu。
要使用苹果的 Swift Package Manager 集成,将以下内容作为依赖添加到你的 Package.swift
:
.package(url: "https://github.com/vapor-china/vapor-alisms.git", from: "1.0.1")
这里是一个 PackageDescription
实例:
// swift-tools-version:5.2
import PackageDescription
let package = Package(
name: "MyPackage",
products: [
.library(
name: "MyPackage",
targets: ["MyPackage"]),
],
dependencies: [
// 💧 A server-side Swift web framework.
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0-rc"),
.package(url: "https://github.com/vapor/fluent.git", from: "4.0.0-rc"),
.package(url: "https://github.com/vapor/fluent-mysql-driver.git", from: "4.0.0-rc"),
.package(url: "https://github.com/SpectatorNanWithZZC/vapor-alisms.git", from: "1.0.0")
],
targets: [
.target(name: "App", dependencies: [
.product(name: "Fluent", package: "fluent"),
.product(name: "FluentMySQLDriver", package: "fluent-mysql-driver"),
.product(name: "Vapor", package: "vapor"),
.product(name: "AliSMS", package: "vapor-alisms")
]),
.target(name: "Run", dependencies: ["App"]),
.testTarget(name: "AppTests", dependencies: [
.target(name: "App"),
.product(name: "XCTVapor", package: "vapor"),
])
]
)
let client = AlismsClient(scheme: "https", accessKeyId: "key", accessKeySecret: "secret")
try client.sendSms(code: SMSCode(code: "123456"), phone: "13812341234", signName: "you sign name", templateCode: "you template code", req: req)
批量发送短信
AliSMS is released under an MIT license. See License.md for more information.