The first example is a factory class. A factory is a piece of code that helps you to create and configure an object. A factory can be a function or method, a static class, or an instantiated class. Usually it is not necessary to instantiate a factory, so static classes are often used for that. But I think a factory might as well be instantiated. Doing that allows you to configure or extend the factory so it gives you even more flexibility over having a single static factory method.
Also, I think in most cases static classes are just an excuse. People often tend to promote global functions or variables to a static class to make 'clean' code, but it provides little improvement. It was a little useful before PHP supported namespaces, but nowadays, I think you should be careful when creating static classes.
The same applies to singletons, although it has its use, because in some cases you want to have only one instance of a class. Examples of this include connection pools, or hardware controllers. Having multiple instances of some object might cause problems, so that's a good reason to use singletons.
But people often make an object a singleton when there is no need. In that case, I think it's just a way to hide the fact that you're using globals, and it's bad practise.
But a singleton is not a static class. It is just a class that hides its contructor and provides a static method to reach the single instance of the class. It is similar, but not the same as a static class.
I can recommend reading Head First Design Patterns. It explains both patterns (and many more) in a fun and accessible way. The code examples lean towards Java, but that's hardly a problem.
staticclasses in php. You simply can't use them.new Class, i could just use these static classes?final private function __construct() { }Optionally throw an exception here too.