Description
Description
A client I'm working with uses SourceGuardian to encrypt their product before delivering it to their customers. They want to use Symfony's routing component and PHP attributes. Reading attributes from encrypted code works fine because attributes are part of the encrypted bytecode.
However, the component attempts to parse the PHP files it is supposed to extract routes from in order to find out which classes it declares:
This of course fails in our scenario because the source code is not readable anymore. In our application, we currently work around this problem by extending AnnotationDirectoryLoader
and overriding the findClass()
method and constructing the class name under the assumption that the project follows PSR-4.
Parsing PHP code to gather class names in projects that follow PSR-4 feels unnecessary. In addition, the service discovery feature of the DI component also uses PSR-4 and reflection instead of parsing PHP files. I think, we should offer a PSR-4 attribute loader for the routing component and consider deprecating the PHP parsing logic.
Example
No response