Sending SMS from your PHP application using Twilio

I am constantly hearing that one of the advantages of going with native mobile apps is that you can send push notifications.

So, one thing people keep forgetting is that all mobile phones can receive a certain format of notifications. Yes, ALL mobile phones… Can you tell what it is yet? Mobile phones have this magical messaging system called SMS…

So you want to send an SMS to one of your users from within your PHP app. Perhaps you want to use it to send a notification, or you just want to keep your customer updated.

So, let me just tell you this. It is stupidly easy. So, once you have signed up for a FREE test Twilio account. Download the PHP helper library or from Github.

Then in your application, include the PHP helper library, add your account credentials: your auth token and your Account SID.

Then you are good to go…

account->sms_messages->create(

        // who is the sms coming from
        $from_number, 

        // the number that is receiving the sms
        $to_number,

        // the sms body
        $sms_body
    );

?>

BOOM, SMS sent. How stupidly easy was that? Now all your apps can communicate with real phones, and it takes hardly any time at all.

Let’s say you don’t want to use PHP, because you are a cool kid using Node or Ruby. Well Twilio has helper libraries for all kinds of languages, and they are all about as simple as this one!

What kind of things would you use it for? Web app notifications, reminders, authentication, or just simply communications.

If you do make anything interesting with Twilio, or even anything else, make sure you let me know! I love to see the kind of things people are making.

Back to the articles