• Amazon Web Services (AWS) Specialist
  • REST API and Payment Systems Expert
  • Mentor, Asynchronous Communicator
  • Open Source Contributor

Building Multi-Architecture AWS Lambda Functions with Bref PHP and PostgreSQL

The Multi-Architecture Challenge

With the rise of Apple Silicon (ARM64) and the continued use of Intel-based (x86_64) systems, developers face increasing challenges in creating applications that work seamlessly across both architectures. This is especially true for PHP developers working with AWS Lambda, where subtle differences can lead to frustrating issues.

Example with Bref PHP Runtime + PDO PostgreSQL Extension

To address these challenges, I’ve created a comprehensive example repository that demonstrates a working multi-architecture implementation of PHP Lambda functions using Bref and PDO PostgreSQL. This example focuses on:

[Read More]

Mezzio Example: Testing Doctrine Entities and Repositories

Overview

In this post, we’ll see how to create a comprehensive testing framework for Doctrine Entities and Repositories. This is a continuation of our Mezzio Example series where we previously created our domain model for an OAuth2-enabled application.

Let’s make sure our Entities and Repositories have full test coverage. The domain model is a significant part of any dynamic application so the code should be in good shape. We don’t want any bugs here.

[Read More]

Mezzio Example: Doctrine Entities and Repositories

Overview

This post brings several pieces of supporting libraries together.

Entities to Support OAuth2 Requirements

We’ll start by defining a minimum domain model via PHP8 Attributes and Doctrine’s new attribute mapping driver. In the short-term, we only need to model what’s necessary for our application’s authentication layer using OAuth2. For now, we’re creating a minimal set of objects to comply with the needs of our supporting libraries’ interfaces. We need a minimum of 6 entities and their corresponding repositories:

[Read More]

Mezzio Example: Psalm Introduction

What is Psalm?

Psalm is a static analysis tool for PHP that helps you identify problems with your code. If you use it, you’ll become a better coder. I promise.

Learn more about Psalm

Here’s a great read – the story of the origins of Psalm at Vimeo and the value it provided the team.

https://psalm.dev/articles/fixing-code-that-aint-broken

In this post, I’ll show a basic setup for static analysis with Psalm in Mezzio applications.

[Read More]

Mezzio Example: Functional and Unit Testing

Where do we start?

It’s a good choice to start any application with a solid structure for testing the application with automated testing tools. That’s why the first post in this series is about testing. Any well-tested application will typically have more lines of testing code than actual application code. Starting with a good structure for testing will pay dividends down the road.

In this post, I’ll show a basic setup for testing Mezzio applications. We’ll get to some more advanced testing topics in later posts.

[Read More]

Mezzio Example: Introduction

What is this?

Let’s create a REST API with Mezzio. In this series, you’ll learn how to create a REST API from the ground up. We’ll use Mezzio as the base framework, Doctrine for the data layer, OAuth2 for authentication and authorization, PHPUnit for automated testing, and several other libraries along the way.

Source Code

I’ve created a new bare-bones application starting with the Mezzio Skeleton Application where all the code shown in this series lives. You can install it in your local environment and hack on it all you want. You’re also welcome to contribute to the example application via PR. Check it out here:

[Read More]

Example Recovery Procedure for MySQL Backup Made with Xtrabackup

We have a pre-existing procedure for backing up a MySQL database using hot backups with the wonderful Percona Xtrabackup and in this case the deprecated innobackupex binary.

Xtrabackup is nice since it creates a clean backup of InnoDB, XtraDB, and MyISAM tables quickly and without locking. There are countless useful features including point-in-time recovery, incremental backups, single table recovery, single partition recovery, I/O throttling, parallel processing, encryption, compression, streaming, and more.

A basic recovery procedure document was needed so I wrote one. Here is is.

[Read More]