Month: January 2017

PHP Autoloader

The autoloader is similar to a troll riding a unicorn on a purple rainbow. You know it happens on a daily basis, but you’ve never seen it happen, even though you wish you had. If you read my last post about “My PHP Story,” then you may know I’ve been using PHP since before the

My PHP Story

In an attempt to help people understand you won’t learn everything overnight, I would like to share with you, my story. This story starts in the early 1990s. I hope this is a post that everyone can read and understand. My Programming History One of my neighbor’s, his dad was a programmer, and they had

Dependency Injection

How does dependency injection work? Is it magic? Does it hurt? The first two questions might be reasonable, and the third one might be something I would ask. Either way, I’ll cover these issues and more. Hopefully, you will agree that this is one of the easier design patterns to understand and implement. When I

PHP Unit Testing

Unit testing can reduce the number of headaches you may have with a large project. You should test each “unit” or piece of code. While it may be difficult for 100% code coverage (testing everything), it should be something you aim to do. I’ll cover assertions, methods, doc blocks, and continuous integration. If you add

Gulp and SCSS

There are so many technologies out there that you can learn; it’s probably impossible to keep up with all of them. It’s still fun to try and learn a little bit about a lot of things. Perhaps we should focus on what we are good at and dabble in everything else. I recently decided to

PHP Type Hinting

PHP type hinting is something I’m a huge fan of and think everyone should use. It removes a lot of the guesswork from your PHP; you know that your method will only accept certain types. Being able to know this in advance will help reduce unexpected errors. PHP’s Basic Types Scalar Types A scalar type

Creating a PHP Package

Make sure you have composer installed if you want to use PHP packages. If you’re new to PHP, then you may not know what a package is or why they’re nice. If you played with Legos as a kid, think about those blocks, they came in different shapes, sizes, and colors. Each had a purpose

Factory Design Pattern

In this post, I’m going to talk about a design pattern; a design pattern is something you can use to solve common problems. I’m going to cover a simple example of the “factory design pattern” and an example that is a little more complicated in another post. This concept may be a bit difficult to

Intro to Object Oriented PHP

To learn how to write Object Oriented PHP, we will start with some basics and build upon those. I will use fictitious and realistic examples. We will also use a simple autoloader, so we don’t have to use includes for each file. Autoloading <?php /** * autoload.php */ function __autoload($class_name) { require_once(“./src/$class_name.php”); } Eventually, you

Top 5 PHP Frameworks

In this post, I’ll review what I believe to be the top five PHP frameworks. These frameworks are in no particular order since they all have benefits and can be handy in different situations. Also, this is a matter of opinion; I urge you to try them out. Even try ones I don’t have listed.