PHP namespace reflection

I am trying to check which classes exist in a namespace, and I have been hinted at using reflection. but it seems like PHP just lacks classes / functions to pre-reflect the namespace.

any suggestions?

+4
source share
2 answers

First, take a look at the docs recommendations that you are right. As a result, you probably have to list everything ( get_declared_classes ), and then for each individual class call ReflectionClass::inNamespace()

+2
source

You can get_declared_classes() find out the classes that were defined in your namespace.

+1
source

Source: https://habr.com/ru/post/1399072/


All Articles