Build the future of communications.
Start Building for Free

Composer posts

  • By Matthew Setter
    How to Lookup Phone Numbers in Plain PHP With Twilio's Lookup API How to Lookup Phone Numbers in Plain PHP With Twilio's Lookup API

    Phone numbers are a very common part of user profiles in modern applications. For example, they let users receive an OTP (One Time Password) to log in to an account or receive a recovery code when they can't access their second-factor device, and they let support staff contact a customer when there is suspicious activity on their account.

    However, how often do we check that the phone number which users store in their profiles is genuine? Today, I'm going to show you how to do it in plain PHP using Twilio's Lookup APIno framework required!

    Tutorial requirements

    To follow this tutorial you'll need three things:

    Create the project directory and install the …

    Read More
  • By Matthew Setter
    How to Send an SMS with Mezzio PHP Framework How to Send an SMS with Mezzio PHP Framework

    Whether we’re voting for our favorite candidate on shows such as X Factor, or receiving two-factor authentication codes to log in to services like MailChimp and GitLab, SMS are virtually ubiquitous in modern life. Not only do they make communication in life and work much easier, it also doesn’t take a lot of code to send them either.

    In this tutorial, you’ll learn how to create a simplistic API that can send an SMS using PHP’s Mezzio framework and Twilio’s PHP SDK.

    Once completed, you will be able to send a POST request to the API’s default endpoint, supplying the phone number to send the message to, and the message to send. If the message was successfully sent, then a JSON response will be returned showing a number of details about the sent SMS. If the SMS was not able to be sent, then an appropriate JSON response will …

    Read More
  • By Brian Iyoha
    Routing Customer Service Calls to Agents in PHP with Twilio Programmable Voice and Laravel with Twilio Programmable Voice and Laravel.png

    Oftentimes when running a business, you might have different departments handling specific cases for customer service. These departments can't always have a dedicated support line that is accessible directly to the public, as various automated troubleshooting options might be in place to assist your customers and reduce spamming. However, most of the time your customers might need to speak directly with a human agent and there's no better way to do this than easily linking the customer directly to an available agent while their call is still active.

    In this tutorial, you will learn how to make use of Twilio Programmable Voice to route calls to third party phone numbers during an active call.

    Prerequisites

    To follow through with this tutorial, you will need the following:

    Project Setup

    Laravel will be used as the application …

    Read More
  • By Dotun Jolaoso
    How to build a Laravel Twilio Package for SMS How to Build a Laravel Twilio Package

    I recently realized that every time I had to do an integration with Twilio for sending SMS in a Laravel project, I used a custom wrapper around the Twilio PHP library to help me simplify the process. However, this became a bit monotonous for me as I always had to copy and paste this wrapper every time I was starting a new Laravel project. In this tutorial, you’ll join me in learning how to build a Laravel Twilio Package to eliminate copying and pasting and benefit from package management. This will also allow other developers such as yourself to make use of this package.

    Technical Requirements

    To complete this tutorial, you will need the following:

    Setting up a New Package

    We’ll be using Composer to set up the package. From the terminal, cd into your project’s directory and run the following command:

    $ composer init
    

    This …

    Read More
  • By Brian Iyoha
    Increase User Engagement by Sending Out Periodic Emails with Laravel, PHP, and SendGrid Increase User Engagement by Sending Out Periodic Emails with Laravel, PHP, and SendGrid

    In this tutorial, we will look at how we can send out periodic emails in a Laravel application using Twilio SendGrid.

    Prerequisites

    In order to follow this tutorial you will need:

    Project setup

    Start off by creating a new Laravel project for your application. This can be done either by using the Laravel installer or Composer. For this tutorial, the Laravel installer will be used. If you don't have the Laravel installer already installed, head over to the Laravel documentation to see how to. If installed, open up a terminal and run the following command to create a new Laravel project:

    $ laravel new periodic-emails
    

    Next, you need to install the Sendgrid PHP Library which will be used for communicating with the SendGrid service. Open up a …

    Read More
  • By Dotun Jolaoso
    Build a Laravel PHP Package that Seeds the Database with Fake Data How to Build a Laravel PHP Package that Seeds Fake Data

    Packages primarily provide a way to add functionality to your Laravel applications and can serve as a great way of decoupling your application. The great thing about building packages is that they can easily be reused. In this tutorial, we’ll be looking at how to get started with building a Laravel package. We’ll be building a package that allows you to generate random fake data specifically in the first names, last names and email fields for a user; a simpler version of the popular Faker PHP Library. Interestingly, down the line we will make use of the same Faker Library to generate seed data.

    Technical Requirements

    To follow along, you’ll need the following:

    • PHP Development Environment
    • Composer globally installed

    Setting up a New Package

    To get started setting up a new Laravel package, we’ll be using Composer. From the terminal, cd into your project’s directory and run the following …

    Read More
  • By Brian Iyoha
    Securing a Laravel PHP Application with 2FA using Twilio Authy Securing a Laravel PHP Application with 2FA using Twilio Authy

    Update January 2022

    For new development, we encourage you to use the Verify API instead of the Authy API. The Verify API is an evolution of the Authy API with continued support for SMS, voice, and email one-time passcodes, an improved developer experience and new features including:

    This blog post uses the Authy API. Any new features and development will be on the Verify API. Check out the FAQ for more information and Verify API Reference to get started.

    In this tutorial, you …

    Read More
  • By Paul Kamp
    Install the Twilio PHP Helper Library Without Composer php-helper-library-no-composer-header

    PHP is a venerable language. As I go to press, it’s in major version 7 and has maintained it’s well-deserved popularity for nearly 25 years.

    With two and a half decades of evolution, we PHP developers have quite a few ways to do things. To wit: many of you ask us how to use Twilio’s PHP Helper Library directly, without a package manager.

    Today, I’ll show you how to install Twilio’s PHP Helper Library on *NIX or Mac OSX without using the package manager Composer.

    Let’s compose some magic.

    Prerequisites to Install The Twilio PHP Helper Library (Without Composer)

    Before we get started with the install, you’ll need to set a few things up, confirm a few others, and find a phone:

    Read More
  • By Marcus Battle
    Build a Wake Word Detection Assistant in PHP using Ratchet for WebSockets and Twilio SMS Wake word detection in PHP using WebSockets

    Due to their data transmission speed and low latency, WebSockets open up exciting possibilities for real-time apps. Many of your favorite apps such as Google Docs, Instagram, and Facebook are already using them to keep us in sync with each other using live data.

    We’re going to dive deeper into the world of PHP WebSocket development by building a wake word and hot word detection assistant that communicates with us via SMS, similar to an Alexa.

    To begin, we’ll use the introductory tutorial, “How to Create a WebSocket Server in PHP to Build a Real-Time Application”. We’ll modify the HTML to create a <textarea> that streams the input value to our WebSocket. Our Socket() class will listen for a list of predefined keywords and upon a match, send an SMS to the user.

    If you haven’t already done so, download the repo here.

    Tools Needed to Complete …

    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.

    Pre-requisites

    Setting Up our Application

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

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