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, 2 factor authentication

How to disable 2-factor authentication in Magento 2.4.0

In previous versions of Magento it was possible to enable 2 factor authentication (2fa) for admin users. In Magento 2.4.0 Adobe decided to kick the security up a notch and force 2-factor authentication for all users in the backend. Now 2-factor authentication is great as it adds another layer of security in your webshop, but it can also be too much. Especially when you work by following OTAP where you have multiple environments.
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.