All Projects → lexxyungcarter → Laravel 5 Messenger

lexxyungcarter / Laravel 5 Messenger

Licence: mit
A Simple Laravel 5, 6, 7 & 8 Messenger with Pusher Capabilities

Projects that are alternatives of or similar to Laravel 5 Messenger

Laravel Form Builder
Laravel Form builder for version 5+!
Stars: ✭ 1,601 (+2034.67%)
Mutual labels:  laravel, laravel-5-package, laravel-framework
Laracrud
Laravel Code Generator based on MySQL Database
Stars: ✭ 238 (+217.33%)
Mutual labels:  laravel, laravel-5-package, laravel-framework
Blogetc
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.
Stars: ✭ 198 (+164%)
Mutual labels:  laravel, laravel-5-package, laravel-framework
Brandenburg
Laravel Authentication Package
Stars: ✭ 79 (+5.33%)
Mutual labels:  laravel, laravel-5-package, laravel-framework
Chat
A Laravel chat package. You can use this package to create a chat/messaging Laravel application.
Stars: ✭ 710 (+846.67%)
Mutual labels:  conversation, laravel, chat
Auth Tests
Always-current tests for Laravel's authentication system. Curated by the community.
Stars: ✭ 230 (+206.67%)
Mutual labels:  laravel, laravel-5-package, laravel-framework
Laravel Potion
laravel - Potion is a pure PHP asset manager for Laravel 5 based off of Assetic.
Stars: ✭ 63 (-16%)
Mutual labels:  laravel, laravel-5-package, laravel-framework
Laravel Gitscrum
GitScrum is a Project Management Tool, developed to help entrepreneurs, freelancers, managers, and teams Skyrocket their Productivity with the Agile methodology and Gamification.
Stars: ✭ 2,686 (+3481.33%)
Mutual labels:  laravel, laravel-5-package, laravel-framework
Laravel Video Chat
Laravel Video Chat using Socket.IO and WebRTC
Stars: ✭ 646 (+761.33%)
Mutual labels:  laravel, laravel-5-package, chat
Mercurius
Real-time Messenger for Laravel
Stars: ✭ 309 (+312%)
Mutual labels:  laravel, chat, pusher
Pusher Chatkit Laravel
Laravel wrapper for the Chatkit PHP SDK. ChatKit is shutting down 😕 - https://blog.pusher.com/narrowing-our-product-focus
Stars: ✭ 21 (-72%)
Mutual labels:  laravel, chat, pusher
Chatify
A Laravel package that allows you to add a complete user messaging system into your new/existing Laravel application.
Stars: ✭ 885 (+1080%)
Mutual labels:  laravel, chat, pusher
Laraupdater
Enable Laravel App Self-Update. Allow your Laravel Application to auto-update itself.
Stars: ✭ 75 (+0%)
Mutual labels:  laravel, laravel-5-package, laravel-framework
Laravel Wang Editor
wangEditor for Laravel
Stars: ✭ 52 (-30.67%)
Mutual labels:  laravel, laravel-5-package
Fluent Facebook
A laravel 5 package for reading and writing to facebook graph object with ease in laravelish syntax
Stars: ✭ 49 (-34.67%)
Mutual labels:  laravel, laravel-5-package
Notifier
NO LIBRARIES socket per page bridge for your Laravel application. (CLIENT PART INCLUDED)
Stars: ✭ 57 (-24%)
Mutual labels:  laravel, laravel-5-package
Laravel Course
Laravel Essentials Udemy course Full Source Code
Stars: ✭ 59 (-21.33%)
Mutual labels:  laravel, laravel-framework
Larrock Core
Core components for LarrockCMS
Stars: ✭ 46 (-38.67%)
Mutual labels:  laravel, laravel-5-package
Laravel Paytm Wallet
Integrate paytm wallet in your laravel application easily with this package. This package uses official Paytm PHP SDK's.
Stars: ✭ 58 (-22.67%)
Mutual labels:  laravel, laravel-5-package
Laravel Editor Md
editor.md for Laravel , markdown editor for Laravel
Stars: ✭ 61 (-18.67%)
Mutual labels:  laravel, laravel-5-package

Laravel 5, 6 & 7 ChatMessenger (+ Pusher)

This package will allow you to add a full user messaging system into your Laravel application. It is a highly intuitive laravel 5/6 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).

Total Downloads Latest Stable Version Latest Unstable Version License composer.lock available

Donating to the project

If 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.

Patreon donate button

Buy Me a Coffee at ko-fi.com

Or by buying products and merchandise at Marketplace.

This funding is used for maintaining the project and adding new features into Code Style plus other open-source repositories.

Laravel Version Compatible?
8.x Yes! (^1.3.0)
7.x Yes! (^1.3.0)
6.x Yes! (^1.2.0)
5.8 Yes!
5.7 Yes!
5.6 Yes!
Laravel Version Compatible Branch
5.5 v1 [1.0.8]
5.4 v1 [1.0.8]
5.3 v1 [1.0.8]
5.2 v1 [1.0.8]
5.1 v1 [1.0.8]

Get on to voting for a tailwind/vue.js/vuerouter version of the project

Features

  • Multiple conversations per user
  • Optionally loop in additional users with each new message
  • View the last message for each thread available
  • Returns either all messages in the system, all messages associated to the user, or all message associated to the user with new/unread messages
  • Return the users unread message count easily
  • Very flexible usage so you can implement your own access control
  • Live chat features using Pusher broadcasting services
  • Ability to set maximum number of participants per thread
  • Ability to generate a unique url for sharing a thread to invite more users into the conversation
  • Ability to add/remove users from a conversation - just like WhatsApp!
  • Ability to star/favourite threads

Common uses

  • Open threads (everyone can see everything)
  • Group messaging (only participants can see their threads)
  • One to one messaging (private or direct thread)
  • Push messages to view without having to refresh the page
  • Have a maximum number of participants in a thread/conversation

Installation (Laravel 4.x - no longer actively supported)

Installation instructions for Laravel 4 can be found here.

Installation (Laravel 5.x)

Laravel 5.6+

composer require lexxyungcarter/chatmessenger

Laravel 5.1 > 5.5

composer require lexxyungcarter/[email protected]

Or place manually in composer.json:

"require": {
    "lexxyungcarter/chatmessenger": "^1.0"
}

Run:

composer update

>>> If using Laravel 5.4 and below

Note: Laravel Messenger supports Package Discovery. If using Laravel 5.5 and above, skip this part.

Add the service provider to config/app.php under providers:

'providers' => [
    Lexx\ChatMessenger\ChatMessengerServiceProvider::class,
],

Publish config:

php artisan vendor:publish --provider="Lexx\ChatMessenger\ChatMessengerServiceProvider" --tag="config"

Update config file to reference your User Model:

config/chatmessenger.php

Create a users table if you do not have one already. If you need one, the default Laravel migration will be satisfactory.

(Optional) Define names of database tables in package config file if you don't want to use default ones:

'messages_table' => 'lexx_messages',
'participants_table' => 'lexx_participants',
'threads_table' => 'lexx_threads',

Publish migrations:

php artisan vendor:publish --provider="Lexx\ChatMessenger\ChatMessengerServiceProvider" --tag="migrations"

Migrate your database:

php artisan migrate

Add the trait to your user model:

use Lexx\ChatMessenger\Traits\Messagable;

class User extends Authenticatable {
    use Messagable;
}

Pusher Integration

This package utilizes pusher/pusher-php-server that 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.

Please check out the examples section for a detailed example usage.

Breaking Changes:

Deprecated Packages

Since Pusher Http Laravel has been deprecated, the current demo uses the latest Laravel 5/6 trends of Broadcasting via events. Checkout THE DEMO to see it in action. It becomes more manageable and expressive to configure channels individually.

If you plan to migrate to Laravel 6, the Pusher Http Laravel deprecated package will prohibit you due to dependency issues. You will simply need to create an event to fire the broadcast message, and a channel for broadcasting. You can check the demo for practical usage.

Migration to v1.2

As pointed out in this issue, the starred property has been moved from threads table to the participants table as it makes much more sense there. (Credits to snarcraft).

run php artisan vendor:publish --provider="Lexx\ChatMessenger\ChatMessengerServiceProvider" --tag="migrations" to copy migration file, then run php artisan migrate.

Starring 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. Same case applied to unstarring a thread. $thread->unstar().

API list with Usage Examples

Thread

  • $thread->messages() - Messages relationship
  • $thread->getLatestMessageAttribute() - Returns the latest message from a thread
  • $thread->participants() - Participants relationship
  • $thread->creator() - Returns the user object that created the thread.
  • $thread->getAllLatest() - Returns all of the latest threads by updated_at date
  • $thread->getBySubject($subject) - Returns all threads by subject
  • $thread->participantsUserIds($userId = null) - Returns an array of user ids that are associated with the thread (NO trash)
  • $thread->participantsUserIdsWithTrashed($userId = null) - Returns an array of user ids that are associated with the thread (with trashed)
  • $thread->addParticipant($userId) - Add users to thread as participants(also accepts array|mixed)
  • $thread->removeParticipant($userId) - Remove participants from thread(also accepts array|mixed)
  • $thread->markAsRead($userId) - Mark a thread as read for a user
  • $thread->isUnread($userId) - See if the current thread is unread by the user
  • $thread->activateAllParticipants() - Restores all participants within a thread that has a new message
  • $thread->participantsString($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).
  • $thread->hasParticipant($userId) - Checks to see if a user is a current participant of the thread
  • $thread->userUnreadMessages($userId) - Returns array of unread messages in thread for given user
  • $thread->userUnreadMessagesCount($userId) - Returns count of unread messages in thread for given user
  • $thread->getMaxParticipants() - Returns the max number of participants allowed in a thread
  • $thread->hasMaxParticipants() - Checks if the max number of participants in a thread has been reached
  • $thread->star($userId = null) - Star/favourite a thread (if no $userId is passed, it defaults to the logged-in user)
  • $thread->unstar($userId = null) - Unstar/unfavourite a thread (if no $userId is passed, it defaults to the logged-in user)
  • $thread->isStarred - check if thread has been starred

Message

  • $message->thread() - Thread relationship (Get a thread the message belongs to)
  • $message->user() - User relationship (Get sender of the message)
  • $message->recipients() - Recipients of this message

Participant

  • $participant->thread() - Thread relationship
  • $participant->user() - User relationship

User - (Lexx\ChatMessenger\Traits\Messagable)

  • $user->messages() - messages relationship (return user messages)
  • $user->threads() - threads relationship (return user threads)
  • $user->newThreadsCount() - Returns the new messages count for user
  • $user->unreadMessagesCount() - Returns the new messages count for user
  • $user->threadsWithNewMessages() - Returns all threads with new messages

You can also check the individual models for more information about the functions. This package also utilizes Scopes in case you need more control over your queries.

Examples

So, Where's the Demo?

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.

Screenshot

Contributing?

Suggestions are welcome and any contributions whatsoever are highly valued. If feeling a little bit shy, feel free to send an email to Lexx YungCarter.

Security

If you discover any security related issues, please use the issue tracker or better yet, send an email to Lexx YungCarter.

Credits

What's Next?

We are on the verge of unleashing a Vue.js version + Examples for those of you requiring a boost in quickly setting up chatrooms/messages in your app.

So:-

  • Laravel + Vue
  • Vue Standalone App (Node)
  • Flutter Standalone Android App

Should you be so greatful to provide code samples, feel free to share your code/repository with us. Thank you in advance!

Special Thanks

This package used cmgmyr/laravel-messenger as a starting point, which in turn initially used AndreasHeiberg/laravel-messenger as a starting point.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].