Build a GraphQL Powered API with Laravel
Often referred to as a platform or programming language agnostic query language, GraphQL is a comprehensive approach to guide software engineers in building data-driven applications. It is, in my opinion, the new API standard, offering client applications the flexibility to request exact data and not an entire record from the database. If you are not yet conversant with this technology or looking for simplified technical content to guide you through, you are in the right place.
In this tutorial, you will learn some of the fundamental concepts required to build a Laravel API powered by GraphQL. This is a shift from the conventional architecture of building REST APIs, as we will take a different approach in this tutorial. To help us explore GraphQL, we will build a bookstore API with an ability to carry out CRUD ( Create, Read, Update, Delete ) operations on data, in your database.
Create a WordPress Plugin to Rebuild Your Gatsby App on AWS using GitHub Actions
For a while, our content editors at Postman had to log into GitHub and rebuild the Gatsby app every time they made a change or published a new blog post to the company’s WordPress. As you can imagine, this became very time consuming and wasn’t the most efficient use of our team’s time.
To remedy this, I decided to sit down and write a PHP plugin for our WordPress Admin Dashboard, in order to enable our content writers to re-publish their changes from within our headless CMS.
We used WPGraphQL to create a GraphQL layer from our WordPress content and query our data via the gatsby-source-graphql plugin to our Gatsby App. The resulting solution allowed our blog to be more secure, faster, and future proof.
The plugin creates Nodes in Gatsby to turn the WordPress Data into pages. This results in the App updating its content at build time. If …
Create a Real-Time Twitter Stream in PHP using Pusher and Laravel
Laravel is one of the most famous PHP MVC frameworks, largely due to its commitment to modern architecture and active community. Laravel 7, the latest release, has added the coolest new features like Blade-X, Stubs, Cache optimization, and much more.
Pusher is the hosted service that enables developers to add real time data and functionality easily and securely by taking care of all the heavy lifting under the hood.
Laravel supports Pusher integration very gracefully, which makes it very easy for developers to add real-time functionality to their application. In this tutorial, we will be using Twitter APIs to fetch tweets based on a specific hashtag, and create a dashboard to display them in real-time using Pusher.
How does Pusher work?
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:
- Composer and the Laravel installer on your machine.
- An authenticated domain on SendGrid. You can follow the guide here to set one up.
- Ngrok installed (for creating a tunnel on your localhost)
Create Migrations and Models
To get started, create a new Laravel project in your preferred location (I am naming mine
sg-inbound), switch to …
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.
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
smsPricingon 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 …
Convert Bitcoin to Local Currency using PHP
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!
To complete this tutorial, you will need the following dependencies globally installed on your computer:
PHP 7 development environment
- Global installation of Composer
- Twilio Account
- Cryptocompare API
- Global installation of ngrok
Set Up Your Development Environment
To kick start our project, we will need to create a project directory for it. You may use
cryptoconverteras this is what I will be using. Create the following files in the project folder:
Next, we need to set up our
.envfile is a hidden file used to store secret and private keys on our servers. …
Verify Phone Numbers with Bref PHP and Twilio Verify
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:
- Composer and npm installed on your computer.
- A Twilio Account
- A root AWS Account (to create an IAM user)
- cURL or Postman installed to test our application endpoints
- The Serverless CLI
Create a Twilio Verify Service
To get started, head over to your Twilio Verify Console and create a new Verify Service. Take …
Create a Currency Data Type using Custom Casts in Laravel 7
Since Laravel version 5.1, as developers have been given the ability to
castattributes 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
updated_atfields on a typical model. These attributes are cast as a
datetimewhich converts the database timestamp to a Carbon instance. The cast types that we have had at our disposal are
However, with the release of Laravel 7, we have the ability to create our own custom
casttypes. 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 …
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 …
Intro to Alpine.js with Twilio Verify and Laravel Livewire
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, …