Skip to content

vapor-china/vapor-alisms

Repository files navigation

Build Status Swift Swift Xcode Xcode MIT

AliSMS is a vapor 4 kit of alibab cloud sms service. It support macOS, Ubuntu. You can use the kit to call alibab cloud sms service.

中文版🇨🇳

Installation

Swift Package Manager

To integrate using Apple's Swift package manager, add the following as a dependency to your Package.swift:

.package(url: "https://github.com/vapor-china/vapor-alisms.git", from: "1.0.1")

Here's an example 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/vapor-china/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"),
        ])
    ]
)

Usage

        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)

Features

Send Batch SMS

License

AliSMS is released under an MIT license. See License.md for more information.