mccool/laravel-auto-presenter
ApiResource/Resource classes and presenter logic.with() in controllers) to automated decorators, simplifying legacy codebases.Adopt if:
Response::json() and Blade).UserPresenter::present($user) calls).Look elsewhere if:
laravel-presenter, Fractal, or custom solutions).spatie/laravel-presenter).For Executives:
"This package automates the process of formatting model data for views—think of it as ‘auto-formatting’ for your UI. Instead of manually writing presenter classes for every model (e.g., UserPresenter::present($user)), it does this automatically behind the scenes. This cuts development time by 30–50% for new features, reduces bugs from inconsistent formatting, and makes our codebase more maintainable. For example, if we want to add a ‘premium badge’ to all user profiles, we can do it in one place instead of updating every controller/view. It’s a low-risk, high-reward upgrade to our data presentation layer."
For Engineering: *"Laravel Auto Presenter lets us declaratively apply view-specific transformations to models without polluting controllers or Blade templates. Key benefits:
with() calls: Decorators are applied automatically when models are bound to views.Carbon formatting, truncation).spatie/laravel-presenter but lacks some advanced features (e.g., nested decorators). For now, it’s a great fit for our [specific use case, e.g., dynamic UI personalization]."*For Design/Systems:
*"This reduces the cognitive load of managing presenter logic across the app. Instead of scattered present() calls, we define decorators in one place (e.g., AppServiceProvider). It’s especially useful for:
data-user-tier="premium").
Example: If we want to show a ‘verified’ badge for users, we add a decorator like this:AutoPresenter::macro('verifiedBadge', function ($model) {
return $model->verified ? '<span class="badge">✓</span>' : '';
});
```"*
How can I help you explore Laravel packages today?