SENDING SMS VIA TWILIO USING PHP
Twilio’s Programmable SMS API helps you add robust messaging capabilities to your applications.
Using this REST API, you can send and receive SMS messages, track the delivery of sent messages, Schedule SMS mesages to send at a later time, and retrieve and modify message history.
The API is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.
Step 1: Register Account on Twilio
You need to register an account on Twilio first. After signing up you will get your API credentials that includes Account SID and Auth Token. After registration, go to Account settings where you can see the secret Twilio API information.
Twilio provides two sets of API credentials if you have a trial account.
Step 2: Enable Geographic Permissions
Twilio provides its services worldwide but you can enable and disable it by configuring geographic permissions. Go to Account settings, scroll down, and you will see the settings for SMS and Voice geographic permissions.
Send messages with the SMS API
Twilio will now monitor messages to prevent content violating our Acceptable Use Policy (AUP).
This helps to ensure and support Twilio Messaging as a trustworthy, high engagement channel and will not slow down the delivery of messages.
If a message you send has violated the AUP, it will be returned and you will receive an error code which identifies the necessary changes you need to make sending it again.
The Twilio PHP Helper Library
Twilio PHP SDK makes it easy to interact with the Twilio API from your PHP application.
Twilio SDK requires PHP version 7.2 or higher.
The recommended method for installing the SDK is via Composer. You can add the PHP SDK to your composer.json file with the require command.
composer require twilio/sdk