I've been working on a PHP application and I've come across cross-cutting concerns such as logging and caching. I'm familiar with implementing these concerns using different approaches like using decorators or aspects in other programming languages. However, I haven't found a straightforward way to handle them in PHP.
I've heard of a feature called "Attributes" in PHP and I'm wondering if they can be used to implement cross-cutting concerns like logging or caching in PHP applications? Can I use attributes to annotate my methods or classes and have some sort of automatic logging or caching applied without explicitly writing that code everywhere?
If anyone has experience with using attributes in PHP or any other creative solutions for implementing cross-cutting concerns, I would really appreciate your insights and guidance. Thanks in advance!