php[architect] logo

Want to check out an issue? Sign up to receive a special offer.

SOLID Foundations

November 2020

Writing software does not follow engineering principles or formulas like we have for building bridges or designing airplane wings. That doesn’t mean anything goes! In this issue, we look at how to use type hints, writing SOLID code, handling monetary calculations, using domain events correctly, and more.

Improving Your PHP with Static Types

By Karl Hughes

As PHP incorporates more features typical of statically typed languages, you have the option of adopting an entirely new programming style. While static typing can make your code easier to understand, refactor, and test, PHP’s implementation isn’t quite the same as other languages. This article covers the state of static typing in PHP and how you can use it to improve your code.

Applying Best Coding Practices to PHP, Part One

By Vinícius Campitelli

When advancing in our careers as developers, we come across some questions about the structure of our software. Before long, the main question about solving a problem is not about what to do anymore, but how to do it elegantly. We start looking for better development tactics and how to make our code mode readable and easier to maintain. Not only because it’s more elegant, but doing so can significantly save us time, as sometimes we spend more time trying to understand it than really writing it. In this self-development journey, everything is beautiful. In this article, I’ll share how you can use the SOLID principles to make your code flexible and maintainable.

Bug-free Money Handling with MoneyPHP

By Piotr Horzycki

Do we really know how to handle one of the fundamental business operations—calculating monetary amounts? Floating-point calculations, often used with financial transactions, are notoriously tricky and error-prone because of how computers process them. In this article, we’ll look at how you can avoid making them in your application.

PHP Puzzles: Destination Point

By Sherri Wheeler

In our last issue, pruned a set of directions to remove values that cancel each other out. It was an exercise in cleaning data, an often crucial step before importing it or processing it elsewhere. In this article, we look at plotting those directions on a grid.

Education Station: Locking Down Resources

By Chris Tankersley

Many of the applications that we write need to access some form of resource. These resources may come in the form of images we need to display, logs we need to write, or external services we need to pull data from. But, at the end of the day, our applications are accessing things outside of the code we write. Let’s look at how we can manage resource access to prevent bugs and lost data.

The Workshop: GUI Applications in WSL with X Server

By Joe Ferguson

We’ve spent the past few months discussing and demonstrating how to use WSL in your PHP development workflow as a better alternative to Virtual Machines by running native Linux on Windows 10. This month we’re going to dive into an unsupported (by Microsoft) territory and cover how to and why we may run GUI applications in WSL distributions.

Sustainable PHP: Developing Domain Events

By Edward Barnard

Domain Events are one of the mainstays of modern Domain-Driven Design. They’re powerful, simple, useful. However, when developing them, we need to consider infrastructure. We’ll examine the need for explicit database transactions, view a table design, and provide a way to do our future selves a favor!

Security Corner: Self-obfuscating Value Objects—A Design Pattern for PII

By Eric Mann

Leveraging commonly used and well-defined design patterns is paramount in ensuring your application is stable and maintainable over time. Extending those design patterns to focus on security-first is an effective way of ensuring your application and its data are reliably secure. One such pattern is a Value Object, which can be customized to automatically and transparently obfuscate the value it contains. We can use such an object to protect PII, availing it still for use within your business logic while preventing accidental leaks or disclosing the sensitive data with which you work.

Community Corner: Podcast—Mic Check

By Eric Van Johnson

With it being so difficult to hang out with friends or go to a meetup, podcasts are a great solution to stay plugged in and current on what is going on in the development world. There is a wide range of subject matters for podcasts, but I focused on PHP podcasts and some other general Development podcasts for this article.

finally{}: Put Your Best Page Forward

By Beth Tucker Long

Is your workload filled with looming deadlines and minimum viable products? Is the focus on pivoting quickly and allowing user complaints to drive feature development? Are we exhausting our customers? Are we exhausting ourselves?

Leave a comment

Use the form below to leave a comment: