Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now
Build the future of communications.
Start building for free
  • By Marcus Battle
    How to Send 1000 (or more) Text Messages in PHP Without Timing Out How to Send 1000 (or more) Text Messages in PHP Without Timing Out

    PHP developers of all experiences are painfully aware that your script may not execute if it takes longer than 30 seconds to process. There’s nothing worse than failing to do proper testing and finding that your code doesn’t scale in production.

    In a previous tutorial, I shared how you can calculate the script execution time of sending SMS messages. At the conclusion we discovered that each message takes about .33 seconds to send, meaning that PHP’s 30 second timeout will allow you to send 90 messages before failure.

    So what do you do when you want to send more than 90 messages? What about 1000?

    Unfortunately, if you want to send bulk SMS (or WhatsApp) messages using the standard Programmable Messaging API, it’s not going to scale in PHP. Great engineering practices would suggest that you break apart your requests and run batches asynchronously. However, Twilio engineering has …

    Read More
  • By Marcus Battle
    Calculating Script Execution Time in PHP to Send an SMS with Twilio Calculating Script Execution Time in PHP to Send an SMS with Twilio

    New PHP developers may not be aware that every script you run has 30 seconds to complete. If your API requests, database transactions, and data processing don’t complete in time, you will experience a server timeout. This is because PHP's max_execution_time helps prevent poorly written scripts from tying up the server.

    Most developers will spend time Googling workarounds instead of focusing on the fact that this behavior is not a bug. In reality, people shouldn’t wait a whole minute or more for your page to load or process to complete within the browser. It’s just not an ideal user experience.

    In this tutorial, we’ll learn how to measure the time it takes to send an SMS with Twilio Programmable Messaging for better application performance. At the conclusion, you will have learned how to:

    • Build a simple script to send an SMS in PHP
    • Use PHP’s microtime() function to measure script …
    Read More
  • By Marcus Battle
    How to Check Your Twilio Account Balance using PHP How to Check Your Twilio Account Balance using PHP

    Developers often forget that when building a communication-based app it’s important for you to monitor costs in real time. Imagine you’ve built a bulk SMS application and need to send one message to 1,000 subscribers. You already know that (in the US) this SMS will cost you $7.50 USD ($.0075/msg), but are you aware of the available balance on your account to send it? The answer is in the console, but it’s tedious logging into your Twilio account every time you need to use the API within your app.

    If you’re building a PHP application that needs to calculate API costs before use, this tutorial is for you! Maybe your application needs to check your balance before sending SMS or alert you when you’ve used too many voice minutes. Whatever the use case, this quick tutorial will help you integrate your balance into your PHP app.

    Get Started

    This …

    Read More
  • By Marcus Battle
    Custom Laravel 7 Email Verification with Twilio Verify and SendGrid Custom Laravel 7 Email Verification with Twilio Verify and SendGrid

    When you allow users to register with your application without verifying their email addresses, you decrease the likelihood of being able to contact them again. If they’re allowed to sign up with an incorrect email address, there’s no guarantee that they’ll navigate to their profile and fix it later.

    Email verification exists to correct this user experience flaw. When implemented correctly, email verification allows a user to sign up and receive a secure token sent to their email to confirm that they’re both real and have provided the correct email address.

    By adding verification to any step of your user‘s journey, Twilio Verify allows you to fight fraud before it starts and verify users with email, SMS, or voice.

    In this tutorial, you’ll be using Twilio Verify and SendGrid to override the default verification logic in Laravel and roll out your own system.

    It’s important to note that Laravel comes …

    Read More
  • By Marcus Battle
    Reduce Spam Registrations in WordPress with Verification Emails using Twilio Verify Reduce Spam Registrations in WordPress

    It’s no secret to WordPress owners that the platform running their website and 35% of the Internet is a spam magnet. Its popularity has caused hackers to push the limits of their creativity, releasing spambots across a third of the Internet. This means that less-secure websites suffer from exploitations and data integrity issues.

    Whether you are hosting your favorite cooking blog or The New York Times, your WordPress website needs extra prevention to stop fraudulent activity. That’s why we’re creating an email verification system and incorporate it directly into the WordPress user registration flow to reduce fraud. At the end of this tutorial, you will have a custom WordPress plugin that sends a secure email to every registrant before they can access their account.

    Why Not Use WordPress’ Default Confirmations?

    If you’re unaware, WordPress does include email confirmation for new registrations, but this alone doesn’t prevent skilled hackers from …

    Read More
  • By Marcus Battle
    How to Debug and Fix PHP Mail in Localhost How to Debug and Fix PHP Mail in Localhost

    Sending emails in your local environment using PHP’s mail() function should be straightforward. The function is 20-years-old and one of the most integral parts of any web application; email.

    If you’re not familiar with mail(), it’s a single function that only requires three arguments—a recipient, subject, and message—to deliver an email via one line of code. Sounds simple, right?

    Well, if you’ve actually tried to use the function in your local environment, you know firsthand that it’s not always that easy. You’re probably reading this tutorial because you’ve experienced the mail() function not working out of the box yourself. Maybe you’re even one of the 343K viewers of this unresolved, 5-year-old Stack Overflow ticket.

    So why isn’t my PHP mail function sending any mail?

    The truth is, there could be a number of reasons why your emails aren’t arriving in inboxes. However, I’ve found that most of those …

    Read More
  • By Marcus Battle
    Create a Video Conference App using Laravel, PHP, and Vue.js Create a Video Conference App in Laravel 7.png

    During times where we can’t be together physically, video conferencing helps reinforce and establish relationships by allowing us to monitor visual cues sometimes lost over the phone. Conference calls are great, but studies show that when we can’t see who’s talking, we’re more likely to get distracted by our favorite apps. Not only is video conferencing an excellent way to increase focus during meetings, but it’s also a great method for keeping in touch with family and friends during the coronavirus pandemic.

    In this tutorial you will learn how to create your own video conferencing app in Vue.js, using the Laravel framework and Twilio Programmable Video. There is no software to download, nor tutorials to follow. The final result is a link to a mobile-friendly video chat room, capable of hosting up to 50 participants.

    NOTE: This tutorial is written specifically for Laravel 7+ (although it may …

    Read More
  • By Marcus Battle
    Create Your Own Conference Line in PHP using Twilio Programmable Voice Create Your Own Conference Line in PHP using Twilio Programmable Voice

    As much of the world is grappling with the overnight shift to work from home, the trusted conference call is a staple that is needed now more than ever. Teams that have only been separated by floors and walls are now teleworking from makeshift offices in kitchens and bedrooms.

    While many software-as-a-service solutions exist, your company or organization may desire to roll out your own custom conference call solution or add it to an existing application. If PHP is your language of choice, this quick tutorial will teach you how to build your own conference line in PHP using Twilio Programmable Voice. Your team members will actually be able to call it directly and speak with one another from anywhere in the world.

    If Node.js happens to be your preferred language, Sam Agnew just wrote an awesome version of this tutorial on the Twilio blog.

    Prerequisites

    This tutorial …

    Read More
  • By Marcus Battle
    How to Send Bulk Emails in PHP using Twilio SendGrid How to send bulk emails in PHP using Twilio SendGrid

    Frequent and relevant communication with attendees is necessary when planning an event. There are too many opportunities for confusion if timely and detailed messages are not sent. Even when everything goes according to plan guests still need reminders as the event date draws closer.

    Bulk emails are a great method to keep everyone in the loop.

    In this tutorial, we will learn how to send bulk emails to an email list in PHP using Twilio SendGrid.

    We’ll use a foreach() loop to parse through an array of email addresses and build a single array of recipients using SendGrid’s personalization class. SendGrid allows us to personalize each email that every recipient receives. We can even modify content based on the individual email address.

    Tools Needed to Complete This Tutorial

    To complete this tutorial you’ll need the following dependencies installed:

    Get Started with …

    Read More
  • By Marcus Battle
    Send Transactional Emails in PHP with Twilio SendGrid Transactional Emails in PHP with Twilio SendGrid

    Your inbox is undoubtedly full of transactional emails. While they prevent you from getting to inbox zero, without them, you’d have a less informative Internet experience.

    Transactional emails are those sent from within an application when a certain event is triggered. In the case of an e-commerce store, you would send a transactional email when the user has completed their account signup and when they successfully complete their purchase.

    Historically, sending an email in PHP has been one of the simplest tasks to complete. With only the mail() function, you need only to insert a call to the mail() function within any part of your workflow to send a transactional email.

    It’s simplicity, though, has also been its downfall. If you are unfamiliar with the mail() function, know that PHP developers have a love-hate relationship with it because, while it’s easy to implement, it has its challenges with bulk …

    Read More
  • Newer
    Older
    Sign up and start building
    Not ready yet? Talk to an expert.