roundly-consulting/comments-for-laravel
A drop-in comments system for Laravel. Add threaded, polymorphic comments to any Eloquent model with migrations, models, and a simple API, no third-party service required. Configurable and lightweight, it's ready to integrate into your app in minutes.
comments.resources.author config key lets product/engineering teams define the exact author payload exposed to clients—id/type by default, plus name, avatar, or other fields via a custom JsonResource. This is a build-vs-configure decision: use the package’s extension point instead of forking comment serialization.CommentResource now renders author.type as the author class basename (User) rather than the stored actor_type (e.g. App\Models\User). This reduces accidental leakage of internal namespace/class structure to API consumers and supports security-reviewed API contracts.author.type change is contract-affecting for existing API clients even though it ships in a minor release. PMs should treat it as a client-communication and contract-testing item, and decide whether to adopt now, pin the prior version, or schedule a coordinated API change.comments.resources.author value throws an InvalidConfigurationException naming the key. This supports operational readiness: misconfiguration fails clearly rather than silently producing inconsistent API output.Consider it when:
{id, type} author envelope, with the option to add name, avatar, or other fields through a custom JsonResource.author.type, or you can pin versions and migrate clients deliberately.Look elsewhere when:
JsonResource conventions.author.type change explicitly.author.type and cannot be updated; the new default basename behavior will require a custom resource or a client migration.JsonResource receiving the author model.For executives: This release makes comment author data configurable and safer to expose. Instead of leaking internal class names like App\Models\User to every API client, the package now returns a clean type (User) and lets us add customer-facing fields such as names or avatars through configuration. That reduces custom code, improves API hygiene, and keeps a common commenting capability in the package rather than in our backlog. The main caveat is a small API contract change that needs coordinated client communication.
For engineering: Version 1.2.0 adds CommentAuthorResource and the comments.resources.author config key, defaulting to CommentAuthorResource::class. Swap in your own JsonResource to control the author payload; invalid values throw InvalidConfigurationException with the offending key. The behavioral change is that CommentResource.author.type is now the author class basename, not the stored actor_type. Update contract tests and API consumer expectations accordingly, and use the config key rather than forking the resource.
How can I help you explore Laravel packages today?