How to use Twilio to send SMS with CodeIgniter

In this post, I would like to show using of Twilio library within your CodeIgniter 3 project. Twilio is cloud communications platform for building SMS, Voice & Messaging applications.

Here are the steps to send SMS messages using Twilio APIs in the CodeIgniter 3 application:

Step 1: Download and install CodeIgniter.

Step 2: Run below composer command to download twilio/sdk library from your project folder. It will create a new folder called “vendor” and it will download twilio/sdk library into it.

Here is my the directory structure after installing phpoffice/phpspreadsheet

Step 3: Open application/config/config.php file and set you vendor directory path

Step 4: Use twilio/sdk library inside in your controller, here is the sample:

Step 5: Let’s run the application with PHP Built-in web server for testing, issue following command from the root of the project.

Step 6: Now if you access the http://localhost:3030 given number will receive the message/SMS.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Arjun
I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.
DMCA.com Protection Status