liberusoftware/activity-comments-livewire
Livewire components for adding threaded comments to activity feeds in Laravel apps, with real-time updates and simple Blade integration.
This package is a presentation adapter — it does not implement activity logging or comments itself. It ships Livewire components and Blade views that sit on top of the Liberu activity/comments domain layer. Treat it as the UI half of a two-package install.
Minimal path:
composer.json and read require. You will almost certainly need the corresponding core module (e.g. liberusoftware/activity-comments or a module-activity-comments package) plus livewire/livewire. Installing this adapter alone gives you views with no data source.composer require liberusoftware/activity-comments-livewire. If the app uses nwidart/laravel-modules, verify the module is discovered (php artisan module:list) — Liberu packages are built around that structure and the service provider may assume module registration.Livewire::component(...) calls. That alias list is your actual public API — it tells you the component names to drop into Blade (<livewire:... />) far faster than reading the views.php artisan vendor:publish --provider="...ActivityCommentsLivewireServiceProvider" and inspect the tags offered. Config and views are the two you'll usually want locally so you can override markup without forking.HasComments / HasActivity) to your Eloquent model, migrate, then embed the thread component with the model as a parameter:<livewire:activity-comments.thread :model="$post" />
If that renders an empty-but-working shell, your wiring is correct and remaining work is authorization and styling.
Where to look first, in order: composer.json (dependency graph) → service provider (component aliases, config merge) → resources/views (what data each component actually expects) → the domain package's models and contracts.
Component-per-concern, not one mega-widget. These adapters typically split into an activity feed, a comment list, and a comment form. Compose them in your own Blade rather than relying on a single bundled "everything" component — it keeps Livewire payloads small and lets you place the form in a sidebar or modal.
Pass models, not IDs, where possible. Livewire's model binding gives you route-level authorization for free via the authorize()/AuthorizesRequests behaviour. If the package only accepts $commentableId + $commentableType, wrap it in your own thin component that resolves and authorizes the model first. This is the single biggest security lever you have with a 0-star package.
Feed pattern — cursor over offset. Activity feeds grow unboundedly. If the bundled component uses paginate(), prefer cursorPaginate() in your own subclass or a wrapper; deep offset pagination on an activity table degrades fast and LoadMore-style buttons re-render the entire list otherwise.
Event-driven refresh. Let the comment form dispatch an event ($this->dispatch('comment-created')) and have the list #[On('comment-created')] re-fetch, rather than emitting a full-page redirect. This keeps the adapter components decoupled and is the intended Livewire 3 idiom. Verify which Livewire major the package targets before copying this — Livewire 2 uses $emit/$listeners.
Polymorphic scoping in queries. Activity/comment tables are polymorphic (commentable_type, commentable_id). Set a morphMap in a service provider so stored types are stable aliases (post, not App\Models\Post). Retrofitting this after data exists is painful, and it affects authorization checks that branch on type.
Render strategy for feeds. For activity lists that users see on every page load, consider @livewire(..., lazy: true) or rendering the first page server-side and letting Livewire take over on interaction. Pure-Livewire feeds cost a full component hydration on first paint.
Styling integration. These adapters usually ship Tailwind-marked-up views with no CSS build of their own. Point your Tailwind content config at vendor/liberusoftware/**/resources/views/**/*.blade.php or the published views, otherwise the components render unstyled and you'll spend an hour debugging "missing classes."
Authorization as a policy layer, not inline checks. Put create/update/delete gates on the Comment model via a CommentPolicy and reference them consistently. Do not rely on the adapter to check permissions — presentation packages frequently assume the host app has already gated the route.
wire: directives, and component registration. Check the adapter's composer.json constraint and pin it; do not let a composer update drift Livewire under a package that hasn't declared support.NOASSERTION license. The repo has no machine-detectable license. Before commercial use, confirm licensing with the maintainer or treat it as unlicensed. This is a legal blocker, not a nitpick.with('user') / with('creator'). Add protected $with = ['user'] on your model or override the query — the adapter's views won't do it for you.php artisan view:clear and verify the path in config/view.php paths matches where the publisher wrote them.mergeConfigFrom means your published config can go stale relative to package defaults. After upgrading, diff the package's config/ against your published copy.APP_DEBUG. Use Livewire::listen or the browser's network tab to inspect the /livewire/update response body — the JSON contains the real exception when the rendered error is swallowed.vendor/ — you'll lose everything on the next composer install, and with no dependents there's no community pressure keeping those files stable.Livewire::test(...)->set(...)->call('save')->assertHasNoErrors()) and an authorization test proving an unauthorized user cannot post to another user's model. That covers the two failure modes that actually hurt.How can I help you explore Laravel packages today?