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. [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. [Read More]