Photo by Paweł Czerwiński on Unsplash

Interfaces are one of the main features of object-oriented languages, they provide polymorphic behavior and are the base of highly extended patterns and techniques like the Repository Pattern and Dependency Injection, but do they really make sense in PHP? Let’s dig into this.

Intro

First of all, I want to say interfaces are one of my favorite features in an object-oriented programming language, and PHP is not the exception, I love interfaces, and I’m not trying by any means to dismiss its usage, but the opposite! …

Null Object Pattern UML

Before starting the post I would like to say I’m not a “design patterns guru” or something like that. I’m just a passionate developer who loves clean code and elegant solutions, I come across a lot of issues every day and looking for solutions to share with the community is my way to deal with it. If you think my approach is not the best to deal with null return types or want to add something to my post, you can reach me on Twitter and I will be happy to start a polite discussion with you.

Intro

The problem: many…

The guys at Microsoft are giving us nice things these days.

.NET Core is an open source, multi-platform, and multi-purpose runtime for .NET applications developed by Microsoft.

With .NET Core you can build console and web applications using a variety of languages, like C# and F# and run them in Windows, Mac, Linux or Docker.

What will we be building?

The obvious answer when you want to build a demo application is a todo list.

What do we need to start?

Before starting there are certain tools you need to install.

Setting up the workspace

Install the .NET Core SDK, we will be using version 2.1.

Download and install Visual Studio Code.

Install the C# extension. If you want to set up a better workspace for…

The Laravel name and logo are property of Taylor Otwell

Note: most of the concepts exposed in here can also be applied in the Laravel framework.

Laravel Zero is a Laravel-based framework for building command line applications. You can find applications built with it and resources to start with it in here.

Testing commands can be a pretty straightforward task or a total headache. Let’s see why.

The problem

Laravel provides an easy way to test your commands as you can see in the following example extracted from the official documentation.

public function test_console_command()
{
$this->artisan('question')
->expectsQuestion('What is your name?', 'Taylor Otwell')…

PHP our loved friend

We have been using the mixed keyword for years into our PHP docblocks to specify that a value can be, well, kinda “mixed”. With the addition of scalar and return type declarations in PHP 7.0, and the subsequent improvements (nullable and void types in PHP 7.1 and object pseudo-type in PHP 7.2) many people may think that a mixed type is not necessary, but I think that now more than ever it is.

Let’s see the problem

People may say that if you depend on a “mixed” type then your design is bad, after all, if you need an integer, why to expect a…

Basically this, PHPCollections

PHPCollections is a set of Java/C#-like collections written in PHP, the idea behind this is to have a similar way of dealing with large and complex amounts of data in a powerful way with a simple API instead of working with plain PHP arrays.

I started this project about a year ago (the first commit date is 10/10/2017!), and for whatever reason I never found the time to complete it, until now of course.

Why PHPCollections?

Maybe you’re thinking right now “why work with collections?”, “What is the big deal?”, “We have beautiful native arrays!”, …

Max

Passionate developer, self-learner, casual basketball player, in love with serverless and web components, TDD is the only way. https://www.devalmonte.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store