"Just add a @Cacheable attribute above the method, and it'll handle the caching automatically!" Sounds simple, right? That's what I thought too. How hard could it be to build a Laravel package that handles method-level caching through PHP attributes? After all, Laravel itself uses attributes extensively.
Join me on an unexpected journey that started with this seemingly straightforward idea and turned into a deep dive into PHP's type system, Laravel's internals, and the challenges of working with code you don't control. We'll explore the various approaches attempted, the dead ends encountered, and the ultimate solutions discovered while trying to maintain type safety and clean API design.
But this talk isn't just about building a caching package. It's about embracing the unknown, staying curious when faced with unexpected complexity, and the value of pursuing ideas even when the path isn't clear.