PHPStan: Find bugs without writing tests

I’m not saying you shouldn’t write tests. But you may find bugs without writing tests using PHPStan. At least, that is what they claim on their website. I took a relatively big PHP project I run commercially to see whether or not PHPStan would help me to find and fix bugs. In this post I will explain how this works. Adding PHPStan config file You need to add a “phpstan.neon” configuration file to the root of your project. Mine looks like this: ...

November 15, 2022 · Maurits van der Schee

MintyPHP v3 is released

I use MintyPHP to quickly build web applications on the LAMP stack and I just released version 3 this month. Since v3 it relies solely on the composer generated autoloader, making the software faster and making it integrate even better with your IDE. Now the IDE can detect missing dependencies and can autocomplete the PHPunit tests. Also, since version 3 the config format has changed, allowing easier use of environment variables (via getenv) in the config files. ...

October 30, 2022 · Maurits van der Schee

Beelink "MINI S" N5095 under 200

I want my computers to be small, silent and repairable and use as little energy as needed, especially when idle. I recently bought a Beelink “MINI S” N5095/16GB/256GB computer with slots for both the DDR4 RAM and the M2 SATA drive. It has an external power supply and medium sized fan on a proper heat-sink. It can easily be used as a desktop replacement as it has a power efficient CPU, plenty of RAM and a fast SSD. The slot supports up to 16GB RAM and a 2TB M2 SATA SSD. Prices vary wildly (on AliExpress and Amazon) and if you search well you may find the 16GB/512GB model for less than 200 euro. ...

October 13, 2022 · Maurits van der Schee

Overengineering makes investors happy

Investors want tech startups to use a “latest technology” to gain an “unfair advantage” allowing them to compete in an established market. This “unfair advantage” may be a reason that the investment is going to pay off. therefore startups may say that they are using (for instance) blockchain, AI and distributed systems and that it brings them a lot. The real reason startups can compete with established players is that they are small and efficient with a clear focus on what to build and no customers that slow them down. These things are also called “second-mover” advantages. But in my experience few startups dare to say they are using second mover advantages and are planning to win with better marketing and sales. ...

September 18, 2022 · Maurits van der Schee

Getting started with Font Awesome 6

When you want to integrate the free Font Awesome icons in your application or website you are asked to “Enter your email to get started with a free Kit!” (source). It was always possible to just copy a single line in the head of your HTML. Fortunately this is still possible, this post will explain how. It will also show where to download the distribution for self hosting Font Awesome in your web site or web application. ...

September 17, 2022 · Maurits van der Schee

Web development in Visual Basic .NET 6

In 2015 I was working on a Simple web framework for .NET. Back then I wanted to create an MVC framework that would allow me to run .NET web applications on Linux. Last year I ported the code .NET 5 (cross-platform now) and today I updated the code to support .NET 6. In this post I will show how to write a Visual Basic web application. Install .NET 6 on Ubuntu 22.04 If you are not on Windows and cannot install Visual Studio Community Edition 2022 then these instructions may be welcome to you. On Ubuntu 22.04 you need to execute: ...

August 24, 2022 · Maurits van der Schee

Generate avatars with initials in PHP

For a mobile app I’m doing some front-end development and the design includes a lot of avatars. Unfortunately we don’t have any avatars of our users. Fortunately we do have their names and I’ve learned from Outlook and Trello that you can make great avatars with a user’s initials. In this post I show how to do this using PHP. Our goal The target is to create the following avatar with initials “MS” for my name “Maurits van der Schee”: ...

August 19, 2022 · Maurits van der Schee

Proposal to fix a 2012 bug in Symfony

When your Symfony (PHP web framework) project uses AJAX requests and sessions (logging in) you may run into this 2012 bug where Symfony does not lock the session allowing for data loss on concurrent AJAX requests. I fixed the bug in 2014 in the SncRedisBundle, but that merge was reverted last year, creating an issue for some high traffic sites. In this post I propose a better solution for Symfony. Quick workaround The quick workaround is to use the NativeFileSessionHandler class, which uses the session storage (handler) in the php.ini (using session.save_handler and session.save_path) that does store session files on disk. As long as sessions are not working reliable (due to lack of locking) I advice to stay away from Symfony’s Redis and Memcache support for session storage and use this native variant (that does support locking). ...

May 28, 2022 · Maurits van der Schee

Add a REST API to an existing database

I’ve written PHP-CRUD-API (3k Github stars) that lets you publish an instant REST API for an existing database. The latest version supports a mapping to allow you to clean up the names of your tables and columns. Other important features such as authentication and authorization were already supported. This recent addition makes the software better suited to publish a modern API on legacy systems (that run on MySQL, PostgreSQL or SQL Server). ...

April 28, 2022 · Maurits van der Schee

Bitlocker startup key on an EFI partition

Windows 10 professional supports full disk encryption with a PIN and a Trusted Platform Module (TPM) chip with it’s Bitlocker technology. If you don’t have (or believe in) TPM you can use either a pass-phrase or a USB startup key (file on a USB stick) to unlock your Bitlocker encrypted drive. When I apply full disk encryption on machines at the office it is to protect the data in case of computer theft. For machines that have a single user (me) I use a pass-phrase while for machines have multiple users I use a USB startup key. I carry the USB startup key on my key chain. Using a pass-phrase or USB startup key makes the confidentiality of the data on the system easier to understand and reason about, which attributes to real security. ...

March 24, 2022 · Maurits van der Schee