$> git checkout singleton
Intent
Ensure a class only has one instance and provide a global point of access to it.1
Applications
Short answer: none. Honestly, I have yet to find any practical applications for the singleton pattern in PHP. The original singleton design pattern was made to ensure that only one instance of a class could ever be created. It was used in the context of printer spoolers where you would only ever want one instance created. Out of the box, PHP is a single-threaded environment and usually has a short lifetime within an apache/nginx thread. Even if you used something like React ...