PHPackages                             xetaio/xetaravel-mentions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. xetaio/xetaravel-mentions

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

xetaio/xetaravel-mentions
=========================

A package to parse a @mention from a text and mention the user with a notification.

12.0.0(1y ago)58427.6k↓13.2%21[1 PRs](https://github.com/XetaIO/Xetaravel-Mentions/pulls)1MITPHPPHP ^8.2CI passing

Since May 28Pushed 1y ago2 watchersCompare

[ Source](https://github.com/XetaIO/Xetaravel-Mentions)[ Packagist](https://packagist.org/packages/xetaio/xetaravel-mentions)[ Docs](https://github.com/XetaIO/Xetaravel-Mentions)[ RSS](/packages/xetaio-xetaravel-mentions/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (16)Used By (1)

> # Xetaravel Mentions
>
> [](#xetaravel-mentions)
>
> Unit TestsCoverageStable VersionDownloadsLaravelLicense[![GitHub Workflow Status](https://camo.githubusercontent.com/62e01dbd60cb01a017638e97f926bf919a0c7ba6deab6ec07e3c53872ba31376/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f58657461494f2f58657461726176656c2d4d656e74696f6e732f74657374732e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/XetaIO/Xetaravel-Mentions/actions/workflows/tests.yml)[![Coverage Status](https://camo.githubusercontent.com/c6bfe1677c8d4c741c21ac828037ea92ac05ccb713ae27e7fd659f70f19b8733/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f58657461494f2f58657461726176656c2d4d656e74696f6e733f7374796c653d666c61742d737175617265)](https://app.codecov.io/gh/XetaIO/Xetaravel-Mentions)[![Latest Stable Version](https://camo.githubusercontent.com/fbc21b8c3dc7f6927cd623586713f3d013e8afad7795ec5544cb084e81b95b17/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f58657461494f2f58657461726176656c2d4d656e74696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xetaio/xetaravel-mentions)[![Total Downloads](https://camo.githubusercontent.com/6a010d6c55d0dcfe9ccef6f6d2ce40bb2601780b0ba0761c8bfa583012ff7493/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f78657461696f2f78657461726176656c2d6d656e74696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xetaio/xetaravel-mentions)[![Laravel 12.0](https://camo.githubusercontent.com/9d9aaa85e79f231c19984831c9f0c1db17191b7a8bec6ca844c9659dc1230bb8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d2533453d31322e302d6634363435662e7376673f7374796c653d666c61742d737175617265)](http://laravel.com)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/XetaIO/Xetaravel-Mentions/blob/master/LICENSE)A package to parse `@mentions` from a text and mention the user with a notification.
>
> **By default** this package is configured to parse any text type and it will replace any matched `@mention` with a markdown link (`[@Mention](/users/profile/@Mention)`) if the mentionned user exist in the database. It will also send a notification with the Laravel `Notifiable` trait to all mentionned users. (Inspired from the [laravel-mentions](https://github.com/jameslkingsley/laravel-mentions) package.)
>
> Quick example :
>
> **Input** text :
>
> ```
>   Lorem ipsu @admin crepu @Member quis nostrud @UserDoesNotExist ullamcorper fail@mention nostrud @admin.
> ```
>
>
>
> **Output** text :
>
> ```
> Lorem ipsu [@Admin](/users/profile/@Admin) crepu [@Member](/users/profile/@Member) quis nostrud
> @UserDoesNotExist ullamcorper fail@mention nostrud [@Admin](/users/profile/@Admin).
> ```
>
>
>
> **And** Both `Admin` and `Member` users will be notified. **But** `Admin` will be notified only **one** time. (Yes the Parser include an anti-spam rule.)
>
> ## Table of Contents
>
> [](#table-of-contents)
>
> - [Requirement](#requirement)
> - [Installation](#installation)
>     - [ServiceProviders](#serviceproviders)
>     - [Vendor Publish](#vendor-publish)
>     - [Configuration](#configuration)
> - [Usage](#usage)
>     - [Parser configuration](#parser-configuration)
>     - [Parser configuration methods](#parser-configuration-methods)
> - [Custom Parser](#custom-parser)
> - [Notification](#notification)
> - [Contribute](#contribute)
>
> ## Requirement
>
> [](#requirement)
>
> [![PHP](https://camo.githubusercontent.com/5ef61e5040ad2d4be8064cde6ee1cadb8a371b222cd33971a96b40031cc1f51a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d2533453d372e332d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/5ef61e5040ad2d4be8064cde6ee1cadb8a371b222cd33971a96b40031cc1f51a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d2533453d372e332d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)
>
> ## Installation
>
> [](#installation)
>
> ```
> composer require xetaio/xetaravel-mentions
>
> ```
>
>
>
> #### ServiceProviders
>
> [](#serviceproviders)
>
> Import the `MentionServiceProvider` in your `config/app.php`:
>
> ```
> 'providers' => [
>   //...
>   Xetaio\Mentions\Providers\MentionServiceProvider::class,
>   //...
> ]
> ```
>
>
>
> #### Vendor Publish
>
> [](#vendor-publish)
>
> Publish the vendor files to your application (included the config file `config/mentions.php` and the migration file) :
>
> ```
> php artisan vendor:publish --provider="Xetaio\Mentions\Providers\MentionServiceProvider"
> ```
>
>
>
> Then migrate the database :
>
> ```
> php artisan migrate
> ```
>
>
>
> #### Configuration
>
> [](#configuration)
>
> ```
>
