Download the PHP package kirschbaum-development/commentions without Composer
On this page you can find all versions of the php package kirschbaum-development/commentions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kirschbaum-development/commentions
More information about kirschbaum-development/commentions
Files in kirschbaum-development/commentions
Package commentions
Short Description A package to allow you to create comments, tag users and more
License MIT
Informations about the package commentions
Commentions is a drop-in package for Filament that allows you to add comments to your resources. You can configure it so your users are mentionable in the comments, and it dispatches events so you can handle mentions in your own application however you like.
Installation
Usage
-
Publish the migrations
-
In your
User
model implement theCommenter
interface. - In the model you want to add comments, implement the
Commentable
interface and theHasComments
trait.
Usage with Filament
You are free to register the plugin in your Panel(s); however, there is currently no configuration required or supported at the Panel level although it is a good habit:
There are a couple of ways to use Commentions with Filament.
-
Register the component in your Filament Infolists:
-
Or in your table actions:
- Or as a header action:
Configuring the User model and the mentionables
If your User
model lives in a different namespace than App\Models\User
, you can configure it in config/commentions.php
:
By default, the name
property will be used to render the mention names. You can customize it either by implementing the Filament HasName
interface OR by implementing the optional getCommenterName
method.
Sending notifications when a user is mentioned
Every time a user is mentioned, the Kirschbaum\Commentions\Events\UserWasMentionedEvent
is dispatched. You can listen to this event and send notifications to the mentioned user.
Example usage:
If you have event auto-discovery, this should be enough. Otherwise, make sure to register your listener on the EventServiceProvider
.
Resolving the authenticated user
By default, when a new comment is made, the Commenter
is automatically set to the current user logged in user (auth()->user()
). If you want to change this behavior, you can implement your own resolver:
Getting the mentioned Commenters from an existing comment
Polling for new comments
Commentions supports polling for new comments. You can enable it on any component by calling the pollingInterval
method and passing the number of seconds.
Rendering non-Comments in the list
Sometimes you might want to render non-Comments in the list of comments. For example, you might want to render when the status of a project is changed. For this, you can override the getComments
method in your model, and return instances of the Kirschbaum\Commentions\RenderableComment
data object.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
Sponsorship
Development of this package is sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more about us or join us!
License
The MIT License (MIT). Please see License File for more information.
All versions of commentions with dependencies
league/html-to-markdown Version ^5.1
illuminate/support Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
livewire/livewire Version ^3.5
filament/support Version ^3.2
filament/notifications Version ^3.2
filament/filament Version ^3.2