Serverless applications are applications that are built, deployed, and then executed on-demand. The servers on which they run are provided by the cloud platform to which they are deployed, and the developer only needs to focus on writing the code.
The on-demand aspect ensures that the developer is only charged for execution time, as opposed to being charged for a fixed amount of bandwidth or a specific number of servers.
Bref is an open-sourced project that lets you create and deploy serverless applications, called functions, to AWS Lambda using PHP. It integrates with the Serverless Framework which abstracts the operations involved in deploying and monitoring such applications.
In this tutorial, you will be building a webhook for the Twilio Console Debugger that gets triggered when there is an error with (any of) your Twilio application(s) and send the payload to Slack.
To follow along, you will need:
- PHP 7.2 …
Progressive Web Applications (PWAs) are installable websites that provide an app-like experience for your users. They are made possible through technologies like Service Workers and responsive designs, which enable them to provide nearly the same user experience as native applications.
The Twilio Notify API enables you to send notifications to your users across different channels - Web, SMS, Android, and iOS - using a single API.
In this article, we will be building a recipe PWA with Laravel and Vue.js, with the ability to notify our users when a new post is available using the Twilio Notify API.
To get started with this tutorial you will need the following dependencies:
Twilio Sync is a service provided by Twilio that helps you keep your application state in sync across different services. Specifically, it provides a “stack-agnostic” API that helps you add real-time capabilities to your application.
In this article, we will explore how we can build a custom real-time API analytics tool powered by Sync Lists, a Sync primitive type that helps us synchronize individual JSON objects.
NOTE: You can learn more about Sync Lists and other primitives from the Twilio Sync Object Overview.
To complete this tutorial you will need the following:
- Laravel CLI, Composer, and npm installed on your computer
- Basic knowledge of Laravel
- Basic knowledge of Vue.js
- A Twilio Account
- cURL or Postman installed to test our API endpoints
Creating the Sample Application
We will generate a fresh application with the Laravel installer and enter into the project directory with:
$ laravel …
Occasionally, your application needs to perform some routine tasks in timed intervals such as sending out weekly reports to an administrator or sending monthly updates to your users.
Traditionally, such routine tasks are carried out via individual cron jobs that trigger a shell script or the part of the code to be executed. As the application grows and the number of tasks we need to run increases, cron jobs quickly become difficult to maintain, especially as they don’t come with error reporting/handling features and they can’t be placed in a Version Control System such as Git.
The Laravel Task Scheduler allows us to define our tasks as code while leveraging all of the logging and error handling features available in the framework. With the scheduler, we only need to define a single cron entry that executes the schedule at an interval.
What are we Building?
In this tutorial, we …
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.
To follow along with this post, you will need the following:
- A Twilio account (Sign up for a free account now)
- Composer, Ngrok and Laravel CLI installed on your machine
- Knowledge of the Laravel framework
- A Stripe account
To get started, create a new Laravel application and assign the folder name.
$ laravel new twilio-commerce && cd twilio-commerce
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.
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 …
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.
Completing this tutorial requires the following prerequisites:
Installing PHP Code Sniffer
All of the editors below require PHPCS t …
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 …
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.
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 …