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 Michael Okoko
    Process Incoming Emails with Laravel and SendGrid Inbound Parse Process Incoming Emails with Laravel and SendGrid Inbound Parse

    Sending emails from your Laravel app is a common requirement, but sometimes, you want to receive and process the replies programmatically as well. SendGrid lets you process inbound emails with Inbound Parse. Inbound Parse allows you to provide a webhook URL to process all incoming emails for a domain or subdomain. Subdomains are recommended as they don’t affect your regular domain emails.

    In this tutorial, we will be building a blog application where users can comment on a post by replying to a transaction email.


    To complete this tutorial, you will need:

    Create Migrations and Models

    To get started, create a new Laravel project in your preferred location (I am naming mine sg-inbound), switch to …

    Read More
  • By Ugendu Ositadinma
    Retrieving Account-Specific Pricing for Twilio SMS in Your PHP App Retrieving Account-Specific Pricing for Twilio SMS in Your PHP App

    A major factor to consider when building web applications is evaluating the cost of integrating third-party services. If you’re using Twilio, this tutorial will serve as a guide to finding the cost of making SMS/Messaging requests to the Twilio Programmable SMS APIs.

    Installation Requirements

    To get started with this tutorial, you will need to have the following modules/packages installed on your development machine:

    Here is a guide that can be followed to install Composer globally:

    Creating the PHP Project

    First, create a folder named smsPricing on your local machine where the code will be housed.

    In the folder that was created, create a file named index.php which will contain all the code for this tutorial.

    Now, let’s go ahead and install Twilio's PHP SDK in order to call the necessary APIs required to share the functions. To accomplish …

    Read More
  • By Ladapo Samuel
    Convert Bitcoin to Local Currency using PHP Convert Bitcoin to Local Currency using php.png

    There are different methods of converting bitcoins to local currency and vice versa such as blockchain exchange sites and wallet apps,  Today, this tutorial will walk you through creating your simple Bitcoin converter using SMS and PHP, allowing you to check current market rates on the go!

    Technical Requirements

    To complete this tutorial, you will need the following dependencies globally installed on your computer:

    Set Up Your Development Environment

    To kick start our project, we will need to create a project directory for it. You may use cryptoconverter as this is what I will be using. Create the following files in the project folder:

    • .env
    • webhook.php
    • functions.php

    Next, we need to set up our .env file.

    NOTE: The .env file is a hidden file used to store secret and private keys on our servers. …

    Read More
  • By Michael Okoko
    Verify Phone Numbers with Bref PHP and Twilio Verify Verify Phone Numbers with Bref PHP and Twilio Verify.png

    Bref is a composer package that helps you deploy your PHP applications as AWS Lambda functions. It leverages the Serverless Framework to provision and deploy such applications, and provides support for common frameworks like Laravel, Symfony, and Slim PHP.

    In a previous article, we explored how we can use the Bref PHP framework to forward errors from our Twilio application to a Slack channel. In this article, we will revisit Bref by building a service that verifies users’ phone numbers using the Twilio Verify API.


    To complete this tutorial, you will need:

    Create a Twilio Verify Service

    To get started, head over to your Twilio Verify Console and create a new Verify Service. Take …

    Read More
  • By Shane Rosenthal
    Create a Currency Data Type using Custom Casts in Laravel 7 Create a Currency Data Type using Custom Casts in Laravel 7

    Since Laravel version 5.1, as developers have been given the ability to cast attributes on models. Attribute casting provides a convenient method of converting attributes to common data types. Behind the scenes, Laravel actually uses these casts for the created_at and updated_at fields on a typical model. These attributes are cast as a datetime which converts the database timestamp to a Carbon instance. The cast types that we have had at our disposal are integer, real, float, double, string, boolean, object, array, collection, date, and datetime.

    However, with the release of Laravel 7, we have the ability to create our own custom cast types. For example, maybe you have a model that stores the price of a product or subscription as cents along with currency. We can now create a custom cast that will handle storing …

    Read More
  • By Oluyemi Olususi
    Build a COVID-19 Data Tracker WhatsApp Chatbot using Twilio API for WhatsApp, PHP, and Symfony Build a COVID-19 Data Tracker WhatsApp Chatbot using Twilio API for WhatsApp, PHP, and Symfony

    As the Coronavirus continues to exponentially spread across the globe, software developers around the world are doing the best they can to ensure the distribution of secured and trusted information concerning the Novel Coronavirus. For instance, numerous open-source API projects have been started to provide data to track the number of infected people, recovery rate, and unfortunately, the number of deaths recorded in different countries.

    Commonly, to stay up-to-date with the statistics in your country or neighboring countries requires a browser and surfing the internet to get what is sometimes accurate information.

    In this post, I will show you how to explore one of the recently published open-source APIs built to share the global data. During this process, we will build a WhatsApp chatbot that gives a summary of confirmed and recovered cases and the number of deaths recorded, respectively, by leveraging the infrastructure made available by the …

    Read More
  • By Shane Rosenthal
    Intro to Alpine.js with Twilio Verify and Laravel Livewire Intro to Alpine.js with Twilio Verify and Laravel Livewire.png

    Alpine.js is a relatively new front-end framework that promises the reactive and declarative nature of big frameworks like Vue.js or React.js without having to run npm, compile scripts, configure webpack all in a nice 7.37kb cdn hosted file. You get to keep your DOM, and sprinkle in behavior as you see fit. Think of it like Tailwind for JavaScript. After using Alpine on several enterprise projects, I can testify to its ease of use and scalability.

    According to the Alpine.js docs, its syntax is almost entirely borrowed from Vue.js (and by extension Angular.js), so if you already know either of these frameworks there is a very low learning curve to getting started.


    Before you begin this tutorial, make sure you have the following set up/installed:

    NOTE: We are leveraging the power of Laravel Livewire for this demo, …

    Read More
  • By Dotun Jolaoso
    Build a WhatsApp Currency Conversion Bot with Twilio and Laravel Build a WhatsApp Currency Conversion Bot with Twilio and Laravel

    Over the years, we’ve seen a steady increase in the number of bots and chatbots available to us over different platforms. Brands make use of bots as an exciting way to engage customers, while also providing a way to automate what could normally be considered, monotonous conversations. With it’s over 1.5 billion users and growing, and familiar chat technology, WhatsApp presents a strong case for building a chatbot on it’s platform.

    In this tutorial, we’ll be looking at how we can build a WhatsApp Currency Conversion Bot for converting multiple currencies using the Twilio API for WhatsApp.

    Technical Requirements

    You will need the following to complete this tutorial:

    Setting up Laravel

    There are different ways to set up a new Laravel project. You can do so via the Laravel installer or by …

    Read More
  • By Oluyemi Olususi
    Getting Started with Unit Testing a Laravel API using PHPUnit Getting started with Unit Testing a Laravel API using PHPUnit.png

    Performing unit, automated feature, and API endpoint testings are considered as some of the best practices to ensure proper implementation of specified software requirements, because they help guarantee the success of such applications. Testing, by all means, tends to give you a 100 percent assurance that any incremental changes and newly implemented features in your project won’t break the app. This practice is often referred to as Test-driven Development.

    Laravel, as one of the popular PHP frameworks was built with testing in mind and comes with a testing suite named PHPUnit. PHPUnit is a testing framework built to enhance PHP developers’ productivity during development. It is primarily designed for testing PHP code in the smallest possible components known as unit testing, but also flexible enough to be used beyond unit testing.

    In this tutorial, we will take a test-driven development approach and learn how to test the endpoints of …

    Read More
  • By Chiara Massironi
    Check Out the New Mission in TwilioQuest to Teach PHP Fundamentals! Introducing OSS Elephpant

    Team TwilioQuest is thrilled to announce our newest mission, the OSS Elephpant! This mission introduces players to local development with PHP through a series of fun challenges. Playing through this mission, you will learn fundamental skills with this popular server-side programming language. You can download and play TwilioQuest right now to try it out!

    A new mission

    Board the OSS Elephpant, a massive living colony ship whose slumbering passengers need your help! A series of mysterious malfunctions have imperiled the ship's crew, and only you can restore order by repairing the ship’s systems.

    OSS Elephpant welcome

    The first several challenges within this mission are available today, with many more to come in the following weeks. Be sure to follow us on Twitter or join our mailing list to be the first to hear when even more new PHP content is available.

    Meet the creator of the PHP mission

    "Hi, my name …

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