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

"php" posts

  • By Gary Hockin
    Static Analysis with Psalm PHP Copy of Generic Blog Header 4-10.png

    PHP is great, but its loosely-typed goodness is a double-edged sword. On the one hand, it gives PHP the legendary low barrier to entry, but on the other, magical type juggling inevitably means bugs.

    Because PHP is an interpreted rather than compiled language, catching these type problems is tricky, and often they'll go unnoticed for a long time before they catch up with us somewhere down the road. Problems sit and fester in our code base waiting to strike. Unused code can clutter our application, and there is a myriad of other ways in which we write PHP that won't produce errors but are bugs.

    There are some excellent tools to help us catch errors and find bugs before we even run our code. IDEs like PhpStorm can inspect our code and give us information on potential problems before a script is ever executed.

    Screenshot of PhpStorm IDE showing an inspection finding an unused variable

    Catching problems with our code before …

    Read More
  • By Dotun Jolaso
    Build a Webhook Notification System in PHP with Lumen and Twilio SMS Build a Webhook Notification System with Lumen and Twilio SMS.png

    Webhooks are generally automated calls made from one application to another, triggered whenever a specific event occurs. Each webhook transfers a payload to the receiving application. For example, Twilio uses webhooks to let you know whenever certain events occur such as an incoming SMS message or a phone call.

    A really good use case is when you'd like to be alerted via SMS when different events occur on any third party services integrated with your application. As long as they provide webhooks, we can build a notification system around that.

    In this tutorial, we’ll be using Lumen, a fast micro-framework by Laravel and Twilio to create a reusable notification system for any kind of webhook.

    Technical Requirements

    To follow along, you’ll need the following:

    Setting up Lumen

    There are different ways to set up a new Lumen …

    Read More
  • By Matt Makai
    How to Send Daily SMS Reminders in PHP 7 Laravel Web Apps with cron How to Send Daily SMS Reminders in PHP 7 Laravel Web Apps with Cron

    Sending and receiving SMS is easy with the Twilio API, but what if you want to send regularly-scheduled reminders from your Laravel web applications? In this tutorial, we'll combine Laravel, Twilio Programmable SMS and cron to send daily reminders that are stored in a Laravel data model.

    Project Dependencies

    We'll need the following dependencies to complete this tutorial:

    We can start building our project once you have PHP 7 and Composer installed. We'll sign up for a Twilio account at the appropriate step in the tutorial.

    All of the code for the project can be found within this Git repository on GitHub.

    Create a Laravel Project with Composer and the Twilio Helper Library

    In your terminal, start a new Laravel project named reminder-app using the following command:

    $ …
    Read More
  • By Michael Okoko
    Send a Slack Notification When Laravel Jobs Fail in Laravel 6 using Queue Failing Send a Slack Notification When Laravel Jobs Fail in Laravel 6 using Queue Failing.png

    Laravel provides a queue interface to help you defer long-running tasks such as sending emails/SMS, file processing, etc. As much as you try to avoid it, your queue will fail sometimes and because these failures are ignored by default, you need a way to be notified. In this article, we will explore how to send a Slack notification each time a queue fails.


    Before Laravel 5.8.x, the Slack notification channel was pre-packaged into the framework. If your Laravel version is < 5.8.0, feel free to skip the installation (although you should look into upgrading as Laravel is currently on version 6.0). From Laravel 5.8.x and above, the Slack notification channel is packaged separately from the framework so we have to import it via:

    $ composer require laravel/slack-notification-channel

    Next, update your .env file to include your Slack webhook URL …

    Read More
  • By Gary Hockin
    What’s New in Laravel 6: Ignition and Flare Copy of Photo blog Header 1(1).png

    Laravel 6.0 is released, and as a new major version, there are plenty of fun new features for us to play with. The release notes give us all the highlights, but as part of a recent stream, I decided to take a look at one of the more exciting additions, the new error handler, Ignition.


    Ignition replaces Whoops as the default error handler in Laravel 6, but it works on older Laravel applications going back to version 5.5. The impressive thing about Ignition is because it's designed from the ground up to handle Laravel's specific errors, it can make suggestions on how to resolve errors, and even automatically fix common problems for us.

    If we deliberately add a typo in our blade template name, then Ignition realises this and suggests the fix for us in the green panel.

    Screenshot of Ignition detecting a typo of "homex" and suggesting that we meant to type "home"

    Even smarter is the fact that Ignition can automatically …

    Read More
  • By Michael Okoko
    Create a Database Queue to Send SMS in PHP with Laravel Queues and Twilio SMS Create a Database Queue to Send SMS in PHP with Laravel Queues and Twilio SMS.png

    Queues are ways in which we enable our application to listen and act based on predefined events. They allow us to delay tasks that would otherwise interfere with the user experience or our application’s performance.  

    From the Laravel docs, "Laravel queues provide a unified API across a variety of different queue backends, such as Beanstalk, Amazon SQS, Redis, or even a relational database."

    What are we Building?

    In this tutorial, we will be creating an application that utilizes Laravel queues to send our users “Happy Birthday” messages on their birthday. We will create a command that fetches all users whose birthdays are today, and sends them to the queue to be processed.


    Setting Up our Application

    As our application is Laravel-based, we will create a new Laravel application. If you're not …

    Read More
  • By Ankit Jain
    Create a Slack App that Sends SMS with Twilio and Laravel PHP Create a Slack App that Sends SMS with Twilio and Laravel PHP.png

    Laravel is one of the most famous PHP MVC frameworks, largely due to its commitment to modern architecture and an active community. Notably, it provides all the features that are required to create your project, whether for personal or enterprise-level usage.

    Slack is an online instant messaging and collaboration system that enables users to centralize notifications. From sales to tech support, social media and more, Slack becomes one searchable place where your team can discuss ideas and take action.

    In this tutorial, we’ll be combining Slack, Twilio and Laravel to learn how to send an SMS from Slack. This would be a great feature for situations such as notifying users on the phone regarding an urgent meetup.

    After we’re finished, you will have a running Laravel application that allows you to send SMS to tagged users in a Slack channel.


    1. PHP development environment with Laravel
    2. Composer globally installed
    3. Twilio …
    Read More
  • By Ugendu Ositadinma
    How to Initiate a Voice Call from Laravel PHP with Twilio Programmable Voice Initiate a Voice Call from Laravel PHP with Twilio Programmable Voice.png

    In this tutorial, we will be creating a Laravel application that will be used to make outbound voice calls. We will be making use of Twilio's Programmable Voice feature to learn how to initiate voice calls.

    Technical Requirements

    Completing this tutorial will require the following dependencies and a basic understanding of them.

    1. PHP (Version 7.1 or higher).
    2. Composer.
    3. Laravel.
    4. A Twilio Account.

    Before we proceed with this tutorial, it is expected that you have a voice-enabled Twilio number. In case you do not have one, please proceed to purchase one here. This number will be used for the "from" number later in this tutorial.

    Setting Up Your Development Environment

    Let's install a new Laravel project via the Composer create-project command. From your terminal, run the following command:

    $ composer create-project --prefer-dist laravel/laravel twilio-voice

    This will create a Laravel project for us in the twilio-voice directory.

    Our …

    Read More
  • By Michael Jaroya
    Forward Voicemail Transcriptions to a Slack Channel in Laravel PHP with Twilio Voice Forward Voicemail Transcriptions to a Slack Channel in Laravel PHP with Twilio Voice.png

    In a business environment, audio transcripts allow for easier collaboration as transcripts are easy to distribute and store. It also helps businesses to better understand their customers, which leads to improved customer experience. Lastly, it increases accessibility, particularly to people who are hearing-impaired and non-native speakers.

    At a personal level, transcripts can help one to quickly discover actionable insights and improve accuracy as there is a written record that can be referenced.

    Transcribing doesn’t have to be tedious. Using automated software and tools can expedite the process, thus saving you time to focus on other important things. One tool to expedite transcribing is Twilio’s Voice API.

    In this tutorial, we are going to discuss how to transcribe voicemail and send the transcript to a Slack channel using Twilio.

    Getting Started

    To complete this tutorial, you will need the following:

    Read More
  • By Marcus Battle
    Broadcast a Voicemail to Multiple Numbers in Laravel PHP with Twilio Voice Broadcast a Voicemail to Multiple Numbers in Laravel PHP with Twilio Voice.png

    My son just started kindergarten and his first year of not being homeschooled. To say that everyone was nervous was an understatement. Luckily, his school is filled with caring people who aren’t afraid to embrace technology for efficient communication (and calming nervous parents).

    There we were, running errands after his drop-off and our phone was alerted with an email including a photo and message of his progress. The personal touch of being able to see him relaxed calmed our anxiety, allowing us to enjoy the remainder of our afternoon.

    No matter how much we advance technology, it’s my opinion that we must find ways to include “human touch” as much as possible, even if it’s automated.

    This got me thinking about how else I would like to be contacted by his school, especially in case of an emergency. Wouldn’t it be cool if, instead of 160 characters, I could receive …

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