
When “Just Calling a Function” Isn’t That Simple Anymore
At some point in almost every project, something small starts to feel heavier than it should. You begin with a clean controller that delegates to a handler, then you add validation, then logging. Maybe a transaction. Then consistent error mapping. Nothing dramatic, just normal application growth. A few months later, calling a handler isn’t just “calling a handler” anymore. Some controllers validate first, others rely on the handler. Some catch domain exceptions and map them to HTTP responses. Others let them bubble up. Background workers behave slightly differently. CLI commands do their own thing. The business logic is fine. The execution semantics aren’t. And that’s when it becomes clear: invoking a callable is not just a method call. It’s an execution boundary. That realization led to CallableInvoker . Invokable objects have become common in modern PHP, from single-action controllers to DDD-style handlers using __invoke . After using them extensively, I noticed something subtle: the
Continue reading on Dev.to
Opens in a new tab



