โ˜… Creating PHP interfaces, traits, and classes dynamically at runtime

6 ยท Freek Van der Herten ยท April 25, 2022, 12:44 p.m.
PHP is a wonderful dynamic language that's capable of many cool things. I recently stumbled upon something quite fantastic that I want to share with you. In most projects you'll probably create one class or interface per file. interface MyInterface { } What is less common is that you can create multiple classes or interfaces per file. interface MyInterface { // implementation } interface AnotherInterface { // implementation } What is even less common is that you can conditionally defin...