Pragmatic PHP:
Studying Singletons
By Edward Barnard
Practice makes perfect, except when writing PHP code! Our new column Pragmatic PHP explains patterns and variations I’ve used over the years. The better we understand a pattern, the better we can successfully solve the problem before us. This month we’ll take a deep dive into the Singleton Design Pattern. Even though it’s generally considered an anti-pattern, we’ll see useful variations I use time and again. Can global state, static methods, and properties be unit tested? Certainly. We’ll see how.
This article was originally published in the September 2019 issue of php[architect] magazine. To read the complete article please subscribe or purchase the complete issue.
Leave a comment
Use the form below to leave a comment: