How can I get class, property, and method data from files without executing their code, similar to R
Posted
by Chris
on Stack Overflow
See other posts from Stack Overflow
or by Chris
Published on 2010-06-09T05:16:51Z
Indexed on
2010/06/09
5:22 UTC
Read the original article
Hit count: 135
php
I have a bunch of PHP files with classes, in them (although I can't be 100% sure that they won't have code outside of classes in them too), and I need to parse these files to get information about the classes, such as the names of the classes, the methods, the properties, whether they are private/public/static, etc. I looked at PHP's reflection classes and this is very close to what I want but the reflection doesn't seem to use external files and it appears to need to define the classes first. I need to make sure that none of the code is executed and I will be editing the files so I can't guarantee that they will even be error-free.
Any suggestions?
Thanks.
© Stack Overflow or respective owner