Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Presenter Laravel Package

robclancy/presenter

RobClancy Presenter is a Laravel package for decorating models and other objects with presentation logic, keeping views clean and models focused. Define reusable presenter classes to format output, handle HTML, and separate display concerns from domain code.

View on GitHub
Deep Wiki
Context7

Decorate your objects using presenters. Primarily to keep presentation logic out of your models.

Frequently asked questions about Presenter
What is robclancy/presenter and what problem does it solve?
robclancy/presenter is a Laravel package that lets you decorate models and other objects with dedicated presenter classes. Instead of scattering formatting and HTML logic across your Eloquent models or directly in Blade templates, you move it into reusable presenter classes. The result is thinner models, cleaner views, and display logic that can be unit tested and reused across the application.
How do I install robclancy/presenter in a Laravel application?
Install it with Composer using composer require robclancy/presenter. As a Laravel-oriented package it follows the usual Composer plus service-provider path, so check the repository README for any provider registration or config publishing step that applies to your Laravel version. Once installed, you define presenter classes and attach them to the models or objects that need them. Always confirm the install on a spike branch before rolling it into shared environments.
Which PHP and Laravel versions does robclancy/presenter 3.x support?
The 3.0.0 release raises the platform floor to PHP 8.1 or newer, and it also includes a compatibility fix for PHP 8.1 ArrayAccess deprecations. That means 3.x will not install on PHP 7.4 or 8.0, so environments pinned below 8.1 must stay on the 2.x line. Verify the declared Laravel support range in the package's composer.json against your application version before committing, because a PHP 8.1 floor is often paired with a minimum Laravel major.
How do I create a presenter class for an Eloquent model?
Create a dedicated class that wraps the model and exposes methods returning formatted output, such as display names, URLs, or pre-rendered HTML fragments. Keep domain queries and persistence logic in the model and restrict the presenter to display concerns. The exact base class or interface to extend should be confirmed against the package README for the version you install. Once defined, the presenter can be reused anywhere the same formatting is needed instead of duplicating it in views.
How do I use a presenter inside a Blade view?
The typical pattern is to hand the presenter instance, or the model decorated by it, to the view and then call presenter methods instead of touching raw attributes. That keeps Blade templates declarative and free of conditional formatting logic. Because presenters are plain classes, you can also resolve them through Laravel's container if they have dependencies. Check the README for the recommended wiring for your Laravel version.
Is robclancy/presenter 3.0.0 a breaking change from 2.x?
Yes. The PHP 8.1 minimum is a hard break for consumers on PHP 7.4 or 8.0, so 3.0.0 will not install under an older platform constraint in composer.json. The release notes describe the other change as a fix for PHP 8.1 ArrayAccess deprecations, which is intended as maintenance rather than a behaviour change. Read the actual diff and changelog rather than relying on the summary, since release notes are not a complete backward-compatibility inventory.
Can I use presenters on plain PHP objects, not just Eloquent models?
Yes, the package is described as decorating models and other objects, so Eloquent is not a hard requirement. Any object whose output needs formatting can be wrapped by a presenter class. This is useful for value objects, DTOs, or API resources that need consistent display formatting. Confirm any interface or contract requirements in the package source for your installed version.
What does the ArrayAccess fix in 3.0.0 mean for my existing code?
The 3.0.0 release resolves PHP 8.1 ArrayAccess deprecation warnings, which is hygiene work that removes noise and future breakage rather than adding features. The assessment flags one open question: if the fix tightened method signatures or return types on objects you pass around, consumers could see TypeErrors at runtime. Exercise any code path that touches ArrayAccess-based objects on a spike branch, and confirm whether ArrayAccess is part of the documented public API or purely internal.
What are the alternatives to robclancy/presenter for Laravel?
Common approaches include the separate laravel/presenter-style packages, Laravel API resources for response formatting, Blade components, or simply hand-rolled decorator classes in your own app. Many teams find a small in-house presenter or view-model layer is enough and avoids an extra dependency. Choose based on whether you need the package's specific conventions or just a place to put display logic. Evaluate maintenance activity and version support before adopting any of them.
Is robclancy/presenter actively maintained and safe for production use?
Shipping a major bump alongside a deprecation cleanup is a positive maintenance signal, suggesting an engaged maintainer rather than an abandoned dependency. However, release cadence, security policy, issue response time, license, and the support status of the 2.x line for PHP 8.0 consumers are not confirmed in the available material. Treat adoption as provisional until you have audited the dependency tree, checked open issues and advisories, and validated the package on PHP 8.1+ in staging and CI.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo