BulkGate Helpdesk
  • Languages iconEnglish
    • Czech

›Message

Installation

  • Installation
  • Installation to Nette framework

API Administration

  • API administration & tokens

Message

  • Transactional message
  • Bulk SMS (Campaign)
  • Text of the message
  • Phone Number

Sender type

  • Setting sender type

Sender service

  • Sender Service

Other

  • Country

Delivery confirmations and incoming SMS

  • Delivery confirmations and incoming SMS
  • Bulk delivery confirmation of incoming SMS

Text of the message

The BulkGate\Sms\Message\Text class represents the object of the message text.

use BulkGate\Sms\Message\Text;

The constructor accepts two optional parameters. The first is the $text message template itself. The second is the field $variables that passes variables for the message template.

$text = 'Hi <name>, we wish you all the best to your <age> birthday!';

$variables = [
    'name' => 'John',
    'age' => '29'
];

$message_text = new Text($text, $variables);

The text class supports adding of variables to the text, as seen in the previous example. The symbols <name> and <age> are replaced by appropriate values (<name> by John and <age> by 29) from the $variables field.

You can also set up the text using the text($text, array $variables) method, which accepts the same parameters as constructor.

$message_text->text($text, $variables);

Obtaining message

/** @var BulkGate\Sms\Message\Text $message_text */

echo json_encode($message_text); // output: "Hi John, we wish you all the best to your 29 birthday!"

$message_text->getText();  // output: Hi John, we wish you all the best to your 29 birthday!

$text = (string) $message_text; // output: Hi John, we wish you all the best to your 29 birthday!

echo $message_text; // output: Hi John, we wish you all the best to your 29 birthday!
← PreviousNext →
  • Obtaining message
SolutionsSMS GatewayViber for BusinessBroadcastBulk SMSSMS NotificationsTwo-way SMSSmart SMSMobile ConnectWeb Portal
Partners & DevelopersSMS APIIntegrationsAffiliate programWhite label
SourcesBlogYouTubeFacebookLinkedInTwitterGitHubPackagist
CompanyContactPrivacyTerms and Conditions
Price listsPrice list SMSPrice list ViberPrice list Mobile Connect
SMS GatewayTOPefekt s.r.o. © 2022