Let's talk about code

Hi, I’m Michiel. I’m a professional programmer for more than a decade. I work mostly in PHP and javascript, mainly in Magento and Laravel. I write testable code and love to give testing workshops to you and your colleagues. You can hire me for freelance/consulting jobs.

Contact me Hire me

Blog

Magento 2, Continuous Integration, Integration test, Testing

Testing Magento 2 extensions in a continuous integration pipeline

As you might know i like to write code that is tested. Now, writing tests in Magento can be quite hard, but running your tests in a continuous integration pipeline can be even harder. Even more harder is it to test standalone Magento 2 extensions in a continuous integration pipeline.
Magento 2, Coding tips, Controller

Where to place code in a Magento 2 module?

Magento 2 has a few building blocks for you when building a module, but placing your code in the right place can be hard. Here i try to sum up where you should place your code.
Magento 2, Dependency Injection, di.xml, Coding tips

Using di.xml to improve your code quality

In this article i'm going to show you a technique that i like to apply in some of the larger Magento 2 module i write.
Magento 2, Queue

Leveraging the queue in Magento 2 in a (semi) simple way

Using queus is a good way to move some heavy processing to the background of your application. It makes sure expensive operations don't come in the way of the experience of your end user. But configuring and using queues can be a time consuming process. The method described here does help you get things up and running fast.
Controller, Magento 2

Working with temporary files in Magento 2

Recently i had to create an export in Magento 2 using PhpSpreadsheet. I created the sheet and added my data, but them i did hit a bump in the road: how do i download this file?
Continuous Integration, Integration test, Magento 2, Magento 2 testing, Open source

Revive your Magento integration tests

In my day to day job as a freelancer i get to work on quite a few different Magento setups. Now as i try to practice Test Driven Development (TDD) wherever i can, i kept hitting the same bump in the road: when you have an installation that is around for some time, there is a big chance that the integration test setup is broken.
Composer, Laravel Nova, Laravel, Open source

Introducing Laravel Email on Event

Recently i was working on a Laravel project and i needed to add some sales emails: Onboarding when someone registers, an e-mail when an order was placed. That kinds of things.
Laravel, Testing, Queue

Testing jobs in Laravel

Recently someone in a Slack channel i’m a member of asked the following:I want to test if job A fires job B, but how do you test something like that?Niek ten HoopenEspecially when the queue is set up to be run asychronus this seems impossible to test. The normal flow would be something like this:
Composer, Continuous Deployment, GIT, Valet Plus+, WordPress

Manage WordPress using Composer

It took me a while before i finally found the right combination, but i now have a full working setup where is manage my WordPress dependencies using Composer. Before this i used to have a local copy of my WordPress site where i run all updates, and then committed all code that was changed so i could get deployed. I knew this was dirty, but i've tried on multiple occasions to find a better solution but my Google fu failed me.
Magento 2, Quick Tip

Retrieving orders using the Magento 2 API

Recently i had to fetch order information using the Magento 2 API, and to be more specific: The latest orders with a specific status. This turned out to be a bit harder than i initially expected. Magento has some pretty good documentation on this subject, but i still needed a little bit tinkering to get the right result.