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 Michael Okoko
    Send PDF Invoices via WhatsApp using Laravel, PHP, Stripe, and the Twilio API for WhatsApp Generate and Send PDF Invoices via WhatsApp using Laravel, PHP, Stripe, and the Twilio API for WhatsApp

    Stripe is a payment gateway that provides developer APIs to help you receive payments from your application/website.

    The Twilio API for WhatsApp provides a platform that helps you send any type of business message via WhatsApp through a streamlined API.

    In this tutorial, we will be exploring how to send payment invoices and notifications to our users via WhatsApp when they make payments on our website.

    Pre-requisites

    To follow along with this post, you will need the following:

    Getting Started

    To get started, create a new Laravel application and assign the folder name.

    $ laravel new twilio-commerce && cd twilio-commerce
    

    Next, install our application dependencies using composer. These dependencies include the Twilio SDK and the Stripe PHP library (to …

    Read More
  • By Michael Okoko
    Improving PHP Code Quality with PHP CodeSniffer Improving PHP Code Quality with PHP CodeSniffer

    As a project grows, it becomes necessary to maintain and enforce some defined standards for the code. Such standards help achieve uniformity, readability, and maintainability, irrespective of the engineer that wrote the code. For a PHP project, one of the best ways to enforce such standards is PHP_CodeSniffer (or PHPCS for short).

    PHPCS is a tool that helps detect violations of pre-defined coding standards. It also includes an additional tool that can automatically correct those violations.

    Prerequisites

    To complete this tutorial you will only need Composer globally installed.

    About the project

    PHPCS is framework-agnostic, but for simplicity, we will be using it with a simple Laravel project. The project, called “Twilio Greeter”, displays a list of common greetings depending on the language chosen by the user. You can view the complete source code here.

    The project files that are of interest to us are:

    • PROJECT_ROOT/app/Http/Controllers/WelcomeController.php: Our main controller …
    Read More
  • By Michael Okoko
    Set Up PHP CodeSniffer for Local Development Set up PHP CodeSniffer for Local Development

    PHP_CodeSniffer (PHPCS) is a tool that validates your code against a set of predefined standards and ensures that such standards are maintained across the team. This tutorial will walk you through automating those validations during development by setting up PHPCS on Sublime Text, Visual Studio Code, and PHPStorm.

    Note: The accompanying sample project is available at https://github.com/idoqo/twilio-greeter. You can also download the phpcs.xml to use in your existing project.

    Prerequisites

    Completing this tutorial requires the following prerequisites:

    Installing PHP Code Sniffer

    All of the editors below require PHPCS t …

    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.

    Pre-requisites

    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 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.