Create Transactional Emails you can Reply to in PHP with Twilio SendGrid Inbound Parse
You’ve probably received many emails sent in the format
firstname.lastname@example.org. The irony of no-reply emails are that they often contain information that we would like to respond to. It would be great for businesses sending transactional emails to empower customers to respond to these emails.
Allowing replies to transactional emails is now possible with Twilio SendGrid. This tutorial will teach you how to use Twilio SendGrid Inbound Parse to place a second order to a mock e-commerce store, by replying to a transactional email.
This tutorial will require the following dependencies:
- Global installation of Composer
- Global installation of ngrok
- Twilio Account
- SendGrid Account
- A domain name
Create a Development Environment
From your console window, create a new project directory. Add three files to the newly created directory:
$ mkdir SendGrid && cd SendGrid $ touch Webhook.php Email.php .env
This project will require …
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 …
Send 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 …
How to Create a WebSocket Server in PHP with Ratchet for Real-Time Applications
When WebSockets are discussed, PHP is rarely included in the conversation due to its lack of native support. Additionally, Apache, the HTTP server PHP normally runs on, is not built with persistent connections in mind which forces the responsibility of implementation onto 3rd party libraries.
While there have been great attempts to bring PHP into the discussion of “real-time” development, most have paled in comparison to the Ratchet project; a PHP WebSocket library for serving real-time bi-directional messages between clients and server.
In this tutorial, we will be using Ratchet with PHP to learn how to create a simple WebSocket server that processes messages sent from an HTML form in real time. Our form will display a single
<button>to send a message to all client browsers. Every time the user sends a message their message will be displayed in real time on the other screens.
Build a Wake Word Detection Assistant in PHP using Ratchet for WebSockets and Twilio SMS
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 …
Build an SMS Event Reminder in PHP with Laravel, MySQL and Twilio SMS
In our day to day activities, we might get too busy for seemingly simple tasks. Too busy to drop a message, check up on loved ones or to remember an appointment. You could solve this by setting alarms right? But what if there was a more efficient way for reminders to send a message to your loved one, or request your lunch at a set time without you having to do it?
In this tutorial, we will learn how to use Twilio’s Programmable SMS to create an SMS reminder system with Laravel. At the end of this tutorial, you would have developed a custom SMS reminder system that alerts your users at a specific time via SMS.
In order to follow this tutorial, you will need the following:
Static Analysis with Psalm PHP
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.
Catching problems with our code before …
Build a Webhook Notification System in PHP with Lumen and Twilio SMS
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.
To follow along, you’ll need the following:
Setting up Lumen
There are different ways to set up a new Lumen …
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.
We'll need the following dependencies to complete this tutorial:
- PHP version 7+
- Composer installed globally
- Your Twilio credentials, which you can sign up for an account for free
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-appusing the following command:
Send a Slack Notification When Laravel Jobs Fail in Laravel 6 using Queue Failing
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
.envfile to include your Slack webhook URL …