Download the PHP package byrcsc/laravel-mentions without Composer

On this page you can find all versions of the php package byrcsc/laravel-mentions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-mentions

Laravel Mentions

Latest Version on Packagist GitHub Tests Action Status GitHub PHPStan Action Status Total Downloads

Laravel Mentions adds @mentions to Eloquent models. It detects mentions in plain text or editor markup, resolves them to models, and stores queryable records. When the text changes, it syncs those records and fires an event for each mention added or removed.

Everything else stays yours. The package sends no notifications, renders no HTML, and ships no routes, controllers, or JavaScript.

Read the versioned documentation for the full installation, configuration, and usage guides.

Laravel Tested PHP versions
12.x 8.3, 8.4
13.x 8.3, 8.4

Installation

Install the package:

Publish and run the migration:

Publish the config file to define which models handles resolve to:

How it works

Each mention record links the source model containing the text to the target model being mentioned. Both sides are polymorphic, so comments can mention users, tasks can mention teams, and your own models can mention anything you configure.

Because mentions are stored instead of parsed on demand, you can query them in either direction. Each record also snapshots the matched handle, so history stays readable after a handle changes.

The package includes two parsers:

You can choose a parser per model, replace either parser, and provide custom resolvers for tenant scoping or other lookup rules.

Quick start

Add HasMentions to a model containing mentionable text:

Add Mentionable to a model that can be mentioned:

Point the default resolver at that model and its handle column:

This uses name so it works with Laravel's default User model. In a real application, prefer a dedicated, uniquely indexed username column.

Mentions now sync whenever the source model is saved:

Syncing and events

Saving a model with HasMentions creates new mentions and removes stale ones. Call $model->syncMentions() when you need to sync explicitly, including after saveQuietly(), query-builder updates, or bulk imports that bypass Eloquent events.

Listen for MentionCreated and MentionRemoved to send notifications or run other application logic:

Deleting a source prunes its mention records without firing removal events. Soft deleting keeps them. MentionRemoved means the text stopped mentioning a target, not that a source record was cleaned up.

Querying mentions

Find source models that mention a target:

Query the underlying records from either side:

Out of scope

The package deliberately leaves these concerns to your application:

Versioning

The package follows semantic versioning.

Bug fixes go into the newest version only. To get a fix, upgrade to it.

Questions and issues

This package is maintained by one person, so replies can take a while. Everything gets read.

License

MIT. See CHANGELOG.md.


All versions of laravel-mentions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/contracts Version ^12.0||^13.0
illuminate/database Version ^12.0||^13.0
illuminate/events Version ^12.0||^13.0
illuminate/support Version ^12.0||^13.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package byrcsc/laravel-mentions contains the following files

Loading the files please wait ...