{"id":14974713,"url":"https://github.com/syntaxlexx/laravel-5-messenger","last_synced_at":"2025-04-05T13:08:12.200Z","repository":{"id":26749010,"uuid":"109879194","full_name":"syntaxlexx/laravel-5-messenger","owner":"syntaxlexx","description":"A Simple Laravel 5, 6, 7, 8, 9, 10 \u0026 11 Messenger with Pusher Capabilities","archived":false,"fork":false,"pushed_at":"2024-08-06T10:11:24.000Z","size":461,"stargazers_count":104,"open_issues_count":5,"forks_count":33,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-29T12:06:52.915Z","etag":null,"topics":["chat","cmgmyr","conversation","laravel","laravel-5-package","laravel-chat","laravel-framework","laravel-messenger","laravel-pusher","participants","pusher","pusher-service","thread","unread-messages"],"latest_commit_sha":null,"homepage":"https://messenger-inertia.acelords.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syntaxlexx.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"lexxyungcarter","ko_fi":"acelords"}},"created_at":"2017-11-07T19:11:56.000Z","updated_at":"2025-03-12T09:10:20.000Z","dependencies_parsed_at":"2024-03-18T10:00:26.427Z","dependency_job_id":"db17b301-117f-404d-8097-f8acb12b3dd3","html_url":"https://github.com/syntaxlexx/laravel-5-messenger","commit_stats":{"total_commits":64,"total_committers":7,"mean_commits":9.142857142857142,"dds":0.109375,"last_synced_commit":"9c58f45a6057d3bb88644cc8a14ef7a9a0e15d9b"},"previous_names":["lexxyungcarter/laravel-5-messenger"],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntaxlexx%2Flaravel-5-messenger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntaxlexx%2Flaravel-5-messenger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntaxlexx%2Flaravel-5-messenger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntaxlexx%2Flaravel-5-messenger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syntaxlexx","download_url":"https://codeload.github.com/syntaxlexx/laravel-5-messenger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339158,"owners_count":20923014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chat","cmgmyr","conversation","laravel","laravel-5-package","laravel-chat","laravel-framework","laravel-messenger","laravel-pusher","participants","pusher","pusher-service","thread","unread-messages"],"created_at":"2024-09-24T13:50:58.592Z","updated_at":"2025-04-05T13:08:12.174Z","avatar_url":"https://github.com/syntaxlexx.png","language":"PHP","funding_links":["https://patreon.com/lexxyungcarter","https://ko-fi.com/acelords","https://patreon.com/acelords"],"categories":[],"sub_categories":[],"readme":"# Laravel 5, 6, 7, 8, 9, 10 \u0026 11 ChatMessenger (+ Pusher)\n\nThis package will allow you to add a full user messaging system into your Laravel application. It is a highly intuitive laravel chatmessenger with added features such as maximum number of participants in a conversation, starred threads, and a unique social media sharing link for inviting users to a conversation(otherwise known as Thread in this package).\n\n[![Total Downloads](https://poser.pugx.org/syntaxlexx/chatmessenger/downloads)](https://packagist.org/packages/syntaxlexx/chatmessenger) [![Latest Stable Version](https://poser.pugx.org/syntaxlexx/chatmessenger/v/stable)](https://packagist.org/packages/syntaxlexx/chatmessenger) [![Latest Unstable Version](https://poser.pugx.org/syntaxlexx/chatmessenger/v/unstable)](//packagist.org/packages/syntaxlexx/chatmessenger) [![License](https://poser.pugx.org/syntaxlexx/chatmessenger/license)](https://packagist.org/packages/syntaxlexx/chatmessenger) [![composer.lock available](https://poser.pugx.org/syntaxlexx/chatmessenger/composerlock)](https://packagist.org/packages/syntaxlexx/chatmessenger)\n\n- [Check the Latest LIVE DEMO here](https://messenger-inertia.acelords.com)\n- [Find the Latest Source Code DEMO here](https://github.com/acelords/laravel-messenger-demo-inertia)\n\n![Screenshot 1](https://github.com/acelords/laravel-messenger-demo-inertia/blob/main/screenshots/messenger-admin-4.png?raw=true \"Screenshot\")\n\n## Donating to the project\nIf you've found this useful and would like to buy the maintainers a coffee (or a Tesla, we're not picky), feel free to do so.\n\n\u003ca href=\"https://patreon.com/acelords\"\u003e\u003cimg src=\"https://c5.patreon.com/external/logo/become_a_patron_button.png\" alt=\"Patreon donate button\" /\u003e \u003c/a\u003e\n\n\u003ca href=\"https://ko-fi.com/acelords\" target=\"_blank\" title=\"Buy me a Coffee\"\u003e\u003cimg width=\"150\" style=\"border:0px;width:150px;display:block;margin:0 auto\" src=\"https://az743702.vo.msecnd.net/cdn/kofi2.png?v=0\" border=\"0\" alt=\"Buy Me a Coffee at ko-fi.com\" /\u003e\u003c/a\u003e\n\nOr by buying products and merchandise at [Marketplace](https://store.acelords.com).\n\nThis funding is used for maintaining the project and adding new features into Code Style plus other open-source repositories.\n\n\n| Laravel Version | Compatible?   |\n| --------------- | ------------- |\n| 11.x             | Yes! (^1.5.0) |\n| 10.x             | Yes! (^1.4.0) |\n| 9.x             | Yes! (^1.3.0) |\n| 8.x             | Yes! (^1.3.0) |\n| 7.x             | Yes! (^1.3.0) |\n| 6.x             | Yes! (^1.2.0) |\n| 5.8             | Yes!          |\n| 5.7             | Yes!          |\n| 5.6             | Yes!          |\n\n\n| Laravel Version | Compatible Branch  |\n| --------------- | ------------------ |\n| 5.5             | v1 [1.0.8]         |\n| 5.4             | v1 [1.0.8]         |\n| 5.3             | v1 [1.0.8]         |\n| 5.2             | v1 [1.0.8]         |\n| 5.1             | v1 [1.0.8]         |\n\n\u003e Get on to voting for a tailwind/vue.js/vuerouter version of the project\n\n## Features\n* Multiple conversations per user\n* Optionally loop in additional users with each new message\n* View the last message for each thread available\n* Returns either all messages in the system, all messages associated to the user, or all message associated to the user with new/unread messages\n* Return the users unread message count easily\n* Very flexible usage so you can implement your own access control\n* Live chat features using Pusher broadcasting services\n* Ability to set maximum number of participants per thread\n* Ability to generate a unique url for sharing a thread to invite more users into the conversation\n* Ability to add/remove users from a conversation - just like WhatsApp!\n* Ability to star/favourite threads\n\n## Common uses\n* Open threads (everyone can see everything)\n* Group messaging (only participants can see their threads)\n* One to one messaging (private or direct thread)\n* Push messages to view without having to refresh the page\n* Have a maximum number of participants in a thread/conversation\n\n\n## Installation (Laravel 4.x - no longer actively supported)\nInstallation instructions for Laravel 4 can be [found here](https://github.com/cmgmyr/laravel-messenger/tree/v1).\n\n## Installation (Laravel 5.x)\n### Laravel 5.6+ onwards\n```bash\ncomposer require syntaxlexx/chatmessenger\n```\n\n### Laravel 5.1 \u003e 5.5\n```bash\ncomposer require syntaxlexx/chatmessenger@1.0.8\n```\n\nOr place manually in composer.json:\n\n```php\n\"require\": {\n    \"syntaxlexx/chatmessenger\": \"^1.0\"\n}\n```\n\nRun:\n\n```\ncomposer update\n```\n\n#### \u003e\u003e\u003e If using Laravel 5.4 and below\n\u003e **Note**: Laravel Messenger supports [Package Discovery](https://laravel.com/docs/5.5/packages#package-discovery). If using Laravel 5.5 and above, skip this part.\n\nAdd the service provider to `config/app.php` under `providers`:\n\n```php\n'providers' =\u003e [\n    Lexx\\ChatMessenger\\ChatMessengerServiceProvider::class,\n],\n```\n\nPublish config:\n\n```php\nphp artisan vendor:publish --provider=\"Lexx\\ChatMessenger\\ChatMessengerServiceProvider\" --tag=\"config\"\n```\n\nUpdate config file to reference your User Model:\n\n```php\nconfig/chatmessenger.php\n```\n\nCreate a `users` table if you do not have one already. If you need one, the default Laravel migration will be satisfactory.\n\n**(Optional)** Define names of database tables in package config file if you don't want to use default ones:\n\n```php\n'messages_table' =\u003e 'lexx_messages',\n'participants_table' =\u003e 'lexx_participants',\n'threads_table' =\u003e 'lexx_threads',\n```\n\nPublish migrations:\n\n```\nphp artisan vendor:publish --provider=\"Lexx\\ChatMessenger\\ChatMessengerServiceProvider\" --tag=\"migrations\"\n```\n\nMigrate your database:\n\n```\nphp artisan migrate\n```\n\nAdd the trait to your user model:\n\n```php\nuse Lexx\\ChatMessenger\\Traits\\Messagable;\n\nclass User extends Authenticatable {\n    use Messagable;\n}\n```\n\n# Pusher Integration\nThis package utilizes [pusher/pusher-php-server](https://github.com/pusher/pusher-php-server)\nthat provides pusher services out-of-the-box. All you have to do is require the package, register the service providers, publish the vendor package, and that's it! You're good to go.\n\nPlease check out the examples section for a detailed example usage.\n\n## Breaking Changes:\n### Deprecated Packages\nSince [Pusher Http Laravel](https://github.com/pusher/pusher-http-laravel) has been deprecated, the current \ndemo uses the latest Laravel 5/6 trends of Broadcasting via events. Checkout [THE DEMO](https://github.com/syntaxlexx/laravel-5-messenger-demo)\nto see it in action. It becomes more manageable and expressive to configure channels individually.\n\u003e If you plan to migrate to Laravel 6, the Pusher Http Laravel deprecated package will prohibit you due to dependency issues.\n\u003e You will simply need to create an event to fire the broadcast message, and a channel for broadcasting. You can check the demo \n\u003efor practical usage.\n\n### Migration to v1.2\nAs pointed out in this [issue](https://github.com/syntaxlexx/laravel-5-messenger/issues/10#issue-471480046), the starred\nproperty has been moved from `threads` table to the `participants` table as it makes much more sense there. \n(Credits to [snarcraft](https://github.com/snarcraft)).\n\u003e run `php artisan vendor:publish --provider=\"Lexx\\ChatMessenger\\ChatMessengerServiceProvider\" --tag=\"migrations\"` to copy migration file,\n\u003e then run `php artisan migrate`. \n\nStarring a thread is as easy as calling the `star()` method on the thread. If no userId is passed, it defaults to the currently logged-in user. \nSame case applied to unstarring a thread. `$thread-\u003eunstar()`.\n\n\n## So, Where's the Demo?\n- [Check the Source Code DEMO here](https://github.com/syntaxlexx/laravel-5-messenger-demo)\n\n- [Check the LIVE DEMO here](https://messenger.acelords.com)\n\n\u003e To get a clear picture of how it works, open two to four browsers (private/incognito mode is perfect for this case) and login with different accounts.\n\n![Screenshot](examples/acelords-messenger.jpg?raw=true \"Screenshot\")\n\n### Latest Demo\nWe have a [New Demo Version](https://messenger-inertia.acelords.com) that features the common Laravel Jetstream + Inertia stack.\n- [Check the LIVE DEMO here](https://messenger-inertia.acelords.com)\n- [Check the Source Code DEMO here](https://github.com/acelords/laravel-messenger-demo-inertia)\n\n\n![Screenshot 1](https://github.com/acelords/laravel-messenger-demo-inertia/blob/main/screenshots/messenger-admin-4.png?raw=true \"Screenshot\")\n\n# API list with Usage Examples\n### Thread\n* $thread-\u003emessages() - Messages relationship\n* $thread-\u003egetLatestMessageAttribute() - Returns the latest message from a thread\n* $thread-\u003eparticipants() - Participants relationship\n* $thread-\u003ecreator() - Returns the user object that created the thread.\n* $thread-\u003egetAllLatest() - Returns all of the latest threads by updated_at date\n* $thread-\u003egetBySubject($subject) - Returns all threads by subject\n* $thread-\u003eparticipantsUserIds($userId = null) - Returns an array of user ids that are associated with the thread (NO trash)\n* $thread-\u003eparticipantsUserIdsWithTrashed($userId = null) - Returns an array of user ids that are associated with the thread (with trashed)\n* $thread-\u003eaddParticipant($userId) - Add users to thread as participants(also accepts array|mixed)\n* $thread-\u003eremoveParticipant($userId) - Remove participants from thread(also accepts array|mixed)\n* $thread-\u003emarkAsRead($userId) - Mark a thread as read for a user\n* $thread-\u003eisUnread($userId) - See if the current thread is unread by the user\n* $thread-\u003eactivateAllParticipants() - Restores all participants within a thread that has a new message\n* $thread-\u003eparticipantsString($userId = null, $columns = []) - Generates a string of participant information (The columns here reflect the DB columns in the users table to use when returning the names of participants. For easier management, you can define `CHATMESSENGER_PARTICIPANT_AKA` and set to a specific column. Then you can just ignore passing the $columns[] to the method).\n* $thread-\u003ehasParticipant($userId) - Checks to see if a user is a current participant of the thread\n* $thread-\u003euserUnreadMessages($userId) - Returns array of unread messages in thread for given user\n* $thread-\u003euserUnreadMessagesCount($userId) - Returns count of unread messages in thread for given user\n* $thread-\u003egetMaxParticipants() - Returns the max number of participants allowed in a thread\n* $thread-\u003ehasMaxParticipants() - Checks if the max number of participants in a thread has been reached\n* $thread-\u003estar($userId = null) - Star/favourite a thread (if no $userId is passed, it defaults to the logged-in user)\n* $thread-\u003eunstar($userId = null) - Unstar/unfavourite a thread (if no $userId is passed, it defaults to the logged-in user)\n* $thread-\u003eisStarred - check if thread has been starred\n\n### Message\n* $message-\u003ethread() - Thread relationship (Get a thread the message belongs to)\n* $message-\u003euser() - User relationship (Get sender of the message)\n* $message-\u003erecipients() - Recipients of this message\n\n### Participant\n* $participant-\u003ethread() - Thread relationship\n* $participant-\u003euser() - User relationship\n\n### User - (Lexx\\ChatMessenger\\Traits\\Messagable)\n* $user-\u003emessages() - messages relationship (return user messages)\n* $user-\u003ethreads() - threads relationship (return user threads)\n* $user-\u003enewThreadsCount() - Returns the new messages count for user\n* $user-\u003eunreadMessagesCount() - Returns the new messages count for user\n* $user-\u003ethreadsWithNewMessages() - Returns all threads with new messages\n\nYou can also check the individual models for more information about the functions. This package also utilizes [Scopes](https://laravel.com/docs/5.5/eloquent#query-scopes) in case you need more control over your queries.\n\n## Examples\n* [Controller - MessagesController](https://github.com/syntaxlexx/laravel-5-messenger/blob/master/examples/MessagesController.php)\n* [Controller - ThreadController](https://github.com/syntaxlexx/laravel-5-messenger/blob/master/examples/ThreadController.php)\n* [Event - MessageWasPosted](https://github.com/syntaxlexx/laravel-5-messenger/blob/master/examples/Events/MessageWasPosted.php)\n* [Routes - web](https://github.com/syntaxlexx/laravel-5-messenger/blob/master/examples/routes/web.php)\n* [Routes - channel](https://github.com/syntaxlexx/laravel-5-messenger/blob/master/examples/routes/channels.php)\n* [Views](https://github.com/syntaxlexx/laravel-5-messenger/tree/master/examples/views)\n* [Composer.json Sample](https://github.com/syntaxlexx/laravel-5-messenger/tree/master/examples/composer.json)\n\n\n## Contributing?\nSuggestions are welcome and any contributions whatsoever are highly valued. If feeling a little bit shy, feel free to send an email to [Lexx YungCarter](mailto:syntaxlexx@gmail.com).\n\n## Security\n\nIf you discover any security related issues, please use the issue tracker or better yet, send an email to [Lexx YungCarter](mailto:syntaxlexx@gmail.com).\n\n## Credits\n\n- [/SyntaxLexx](https://github.com/syntaxlexx)\n- [Chris Gmyr](https://github.com/cmgmyr)\n\n## What's Next?\nWe are on the verge of unleashing a [Vue.js](https://vuejs.org) version **+ Examples** for those of you requiring a boost in quickly setting up chatrooms/messages in your app.\n\nSo:-\n- Laravel + Vue\n- Vue Standalone App (Node)\n- Flutter Standalone Android App\n\nShould you be so greatful to provide code samples, feel free to share your code/repository with us. Thank you in advance!\n\n### Special Thanks\nThis package used [cmgmyr/laravel-messenger](https://github.com/cmgmyr/laravel-messenger) as a starting point, which in turn initially used [AndreasHeiberg/laravel-messenger](https://github.com/AndreasHeiberg/laravel-messenger) as a starting point.\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=syntaxlexx/laravel-5-messenger\u0026type=Date)](https://star-history.com/#syntaxlexx/laravel-5-messenger\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntaxlexx%2Flaravel-5-messenger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyntaxlexx%2Flaravel-5-messenger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntaxlexx%2Flaravel-5-messenger/lists"}