#php

Refactor a Never Ending 'if' Statements Into a Rule System

Published at July 26, 2020 ·  7 min read

This comes from a personal experience while working on a big refactor of an Ad Server, in an ad serving system you have creatives, campaigns, ad units, templates, etc. On the client side, meaning the website that will server the Ad it serves the creative code that will ultimately calls the Ad Server requesting an Ad by sending the Creative ID, along with the client information coming from the HTTP request....


Unit Testing with phpunit

Published at June 9, 2020 ·  4 min read

In this post I’m going to explain and walk you through how to write unit tests with PHP using phpunit. First step is to add php unit as a requirement in your composer.json file. You can do that by running the following command. composer require --dev phpunit/phpunit Let’s also go ahead and add an autoload entry to the composer file to make things easier, this is what the composer file should look like....