Skip to Content

PHP SDK

I. Preparation

1) Obtaining SDK Key Information

2) Obtaining Project ID

3) Applying for SMS Signature

  • Domestic SMS: Domestic SMS content consists of two parts: SMS signature and SMS text. You can apply for an SMS signature yourself in the Domestic SMS/SMS Signature module of the SMS Service Console. See detailed application steps in How to Apply for SMS Signature.
  • International SMS: For international SMS, you may leave the SMS signature field empty.

4) Applying for SMS Template

  • Domestic SMS: Domestic SMS content comprises both SMS signature and SMS text, where the SMS text is acquired through invoking the SMS template. You can apply for an SMS template yourself in the Domestic SMS/SMS Signature module of the SMS Service Console. For detailed application steps, see How to Apply for SMS Template.
  • International SMS: You can apply for an SMS template in the International SMS/SMS Signature module of the SMS Service Console. See detailed application steps in How to Apply for SMS Template.

II. Configuring the SDK

1) Installing the SDK

Refer to the UCloud Global SDK Quick Start to install the SDK.

2) Parameter Description

  • Phone Number List (PhoneNumbers): Supports both international and domestic SMS. Use format (86)13812345678 for international SMS, with the international telephone area code prefixed to the mobile number.
  • SMS Template ID (TemplateId): For first-time users, you need to apply for a template on the UCloud Global console. After approval, pass the template ID to this field.
  • SMS Template Parameter List (TemplateParams): Variables can be passed into the SMS template. When applying a template, you need to pass as many variables as there are in the template.
  • SMS Signature (SigContent): For first-time use, you need to apply for a signature in the UCloud Global console. After approval, pass the signature to this field. If there is a default signature, this parameter can be omitted.
  1. For SMS content, each letter, Chinese character, and punctuation mark (both Chinese and English) is calculated as 1 character, with a maximum length of 600 characters.

  2. Domestic: The maximum character limit for a single SMS is 70 characters. Exceeding 70 characters will be counted as “1 SMS for every 67 characters.”

  3. The maximum number of characters in a single sending is capped at 500, with each letter, Chinese character, and punctuation mark (both Chinese and English) considered as 1 character.

  4. Avoid including special characters in SMS content (the SMS package page provides a sensitive word detection tool for checks).

III. Complete Example

Please contact Technical Support.