Why is singleton bad, but share from DI containers, which essentially also create a singleton, is a good pattern? And what's the difference?
In fact, share from DI containers is also bad.
And most of the normal frameworks are moving away from working with the container directly. In Symphony, in the controller you will get not a container, but a figure.
Because all class dependencies must be passed as arguments to the constructor. And as a result, the container is used only when automatically creating classes, so that there is a place to take instances of dependency classes.