我什么时候应该在PHP中使用命名空间?

In most small projects and tutorials i don't see a use of namespaces, but they are present, for example, everywhere in Laravel framework. My question is: should i use namespaces pretty much always, or there's some sort of "algorithm" to evaluate if I need them or not?

The main objective of namespaces is to prevent name collisions, more over they are used to group classes, methods. As you mentioned there are a lot of classes within a Laravel project so namespaces would have to be used to prevent collisions which will happen in big projects.

You can 'nest' namespaces as you desire, this is usually paired to your folder structure and is relevant if you are using PSR-4 autoloading standard which laravel uses.

For example you may a User class (Model) and a User class (Repository). Putting them under

namespace Model

and

namespace Repository

will make a lot of sense to you, PHP and the autoloader.