dongm2ez/larvel-mention

This package is abandoned and no longer maintained. No replacement package was suggested.

a laravel user mentioned package

1.0.1 2017-07-26 02:36 UTC

This package is not auto-updated.

Last update: 2021-10-30 12:14:38 UTC


README

❤️ This package helps you complete @ function

Latest Stable Version Latest Unstable Version Total Downloads License

Requirement

  • PHP >= 5.4.0

Installation

$ composer require dongm2ez/larvel-mention

After installing the library, register the Dongm2ez\Mention\MentionServiceProvider in your config/app.php file:

'providers' => [
    // Other service providers...
    Dongm2ez\Mention\MentionServiceProvider::class,
],

As optional if you want to modify the default configuration, you can publish the configuration file:

$ php artisan vendor:publish --provider='Dongm2ez\Mention\MentionServiceProvider' --tag="config"
<?php

return [
   // They contain the model that will be mentioned
   'users' => [
       // Model that will be mentioned
       'model' => 'App\User',

       // The column that will be used to search the model
       'column' => 'name',
   ],

   // Match the front mentioned info
   'regex' => '/(\S*)\@([^\r\n\s]*)/i',

   // laravel route alias
   'route_name' => 'users.show',

   // output format "html", "Markdown"
   'format' => 'html',

];

Usage

$parseText = Mention::parse("@david @Aaron @Judy @麦索 Balabalabala...");

License

MIT