Category: Standards

Nitpicking over Code Standards with Nitpick CI

There are many ways to make sure your code respects a given code standard – we’ve covered several before. But enforcing a standard team-wide and making sure everyone knows about mistakes before they’re applied to the project isn’t something that’s very easy to do. Travis and Jenkins can bo...

Building a SparkPost Client: TDD with PhpUnit and Mockery

In a previous post, we looked at SparkPost (as an alternative to Mandrill), and explored a bit of the official PHP client. The official client handles a decent amount of work, but I got to thinking about what it would take to build a new client. The more I thought about it, the more it made sense. I could learn about t...

Sourcehunt #4 – Reflection, Authorization, Crons, and more

We skipped January’s Sourcehunt, but we’re back now, ready to boost the stardom of more projects!mult1mate/cron-manager [125 ★] mult1mate/cron-manager is a flexible tasks manager designed for MVC-type applications. It’s used instead of crontab and its purpose is to provide an easy way to manipulate repetitive...

How to Build an API-Only JWT-Powered Laravel App

The Laravel API Boilerplate (JWT Edition) was made on the shoulders of giants like:Dingo API; JWT-Auth, by tymondesigns; CORS on Laravel 5 by barryvdh;In this article, we will learn how to use it to quickly create a fully functional API for an imaginary book wishlist application. As an aside, we will also see how t...

How to Build Your Own Dependency Injection Container

A search for “dependency injection container” on packagist currently provides over 95 pages of results. It is safe to say that this particular “wheel” has been invented.However, no chef ever learned to cook using only ready meals. Likewise, no developer ever learned programming using only “ready code”. In...

Clean Code Architecture and Test Driven Development in PHP

The Clean Code Architecture was introduced by Robert C. Martin on the 8light blog. The idea was to create an architecture which is independent of any external agency. Your business logic should not be coupled to a framework, a database, or to the web itself. With the independence, you have several advantages. For examp...

Modeling an Aggregate with Eloquent

The Aggregate pattern is an important part of Domain Driven Design. It prevents inconsistencies and is responsible for enforcing business rules within a collection of objects. For these reasons alone, it is clear to see why it is a key component of a domain model. Architectural advice recommends that the layer containi...

Flyweight Design Pattern and Immutability: A Perfect Match

The flyweight pattern is a relatively unknown design pattern in PHP. The fundamental principle behind the flyweight pattern is that memory can be saved by remembering objects after they have been created. Then, if the same objects need to be used again, resources do not have to be wasted recreating them.You can think...

Memory Performance Boosts with Generators and Nikic/Iter

Arrays, and by extension iteration, are fundamental parts to any application. And like the complexity of our applications, how we use them should evolve as we gain access to new tools. New tools, like generators, for instance. First came arrays. Then we gained the ability to define our own array-like things (called ite...

Logging with Monolog: From Devtools to Slack

Logging is an important part of the app development/maintenance cycle. It’s not just about the data you log, but also about how you do it. In this article, we are going to explore the Monolog package and see how it can help us take advantage of our logs. Installation Monolog is available on Packagist, which means tha...