Laravel messenger. A full messenger suite for your new / existing laravel app

Overview

Laravel Messenger

Latest Version on Packagist Total Downloads Tests StyleCI License


Preview


Prerequisites

  • PHP ^7.4 | ^8.0 | ^8.1
  • Laravel ^8.42
  • Route model binding enabled in your API / WEB middleware groups.

Features

  • Realtime messaging between multiple models.
  • RESTful API, allowing you to create your own UI or connect to your mobile app.
  • Private and group threads.
  • Message reactions, replies, edits, and deletion.
  • Send image, document, audio, and video messages.
  • Group thread chat-bots. Ready-made bots
  • Customize and create your own chat-bot handlers and bot packages. See the Chat Bots documentation.
  • Add participants in a group thread from your friends list.
  • Permissions per participant within a group thread.
  • Friends, Search, and Online status systems.
  • Private thread approval when the two participants are not friends.
  • Provider avatars, group thread avatars, and bot avatars.
  • Underlying calling system you can extend. See the Calling documentation.
  • Group thread invitation links (like discord).
  • All endpoints are protected behind policies.
  • Scheduled commands for automated cleanup and checks.
  • Queued jobs fired from our event subscribers.
  • Most features can be toggled at runtime using our Messenger facade.
  • MessengerComposer facade allows you to have easy access to the core actions anywhere within your own app, such as sending messages, images, reactions, and more.
  • You can implement or extend your own BroadcastDriver, VideoDriver, and FriendDriver, simply by binding your classes into the container.
  • Support for morph maps on your provider models. See: Morph Maps
  • Optional extra payload when sending messages to allow custom json to be stored with the message.
  • Owner relationships returns a Ghost Profile when not found (null-object pattern).
  • Private threads auto-lock when the recipient is not found / deleted.

Upcoming for v2

  • Temporary Ephemeral conversations.
  • Improved API pagination / filters.
  • Condense attachment routes.
  • Possible extraction of friends system.
  • Improved image manipulation / saving of multiple sizes.
  • Encryption of messages (E2E is the long term goal).
  • Translations for internal messages.
  • Pinned messages.
  • Chat-bots able to trigger off of an event.

Notes

  • This is a Laravel package and must be installed in a laravel application to run.
  • Read through the messenger.php config file before migrating!
  • This is a pure backend driven package providing an API to interact with, thus no web UI or websocket implementation will be setup for you.
  • Calling is disabled by default. You are responsible for implementing your own media server or connecting to a 3rd party provider.
  • Configure your laravel applications broadcast driver and set up your websocket implementation to utilize the real-time broadcast emitted.

Installation

Composer

composer require rtippin/messenger

To complete the setup, please refer to the installation documentation listed below:


Documentation


Addons / Demo

  • Messenger Bots - Pre-made bots you can register within this package.
  • Messenger Faker - Adds commands useful in development environments to mock/seed realtime events and messages.
  • Messenger Web UI - Ready-made web routes and publishable views / assets, including default images.
  • Demo App - A demo laravel app with this core package installed, including a Live Demo.

Credits - Richard Tippin

LICENSE

CHANGELOG

Security

If you discover any security related issues, please email author instead of using the issue tracker.

Comments
  • App\Models\User::name must return a relationship instance.

    App\Models\User::name must return a relationship instance.

    Hi, Thanks for you amazing work ! I trying to make it work on one of my project !

    Sadly I get stuck with this error.

    [2021-03-18 20:27:02] local.ERROR: App\Models\User::name must return a relationship instance. {"userId":26,"exception":"[object] (LogicException(code: 0): App\\Models\\User::name must return a relationship instance. at /Users/sylvain/Documents/dev/obpro/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php:464)

    I put that in my User Model because I use Username instead of 'name'

    public function name(): string { return strip_tags(ucwords($this->username)); }

    Any idea ? Thanks

    opened by lps83 11
  • Issue sending message after initiating conversation

    Issue sending message after initiating conversation

    After initiating a conversation and creating a thread, when trying to send a message on the same thread, getting the following as the response: "Not authorized to send messages." If you could provide a demo of the API and payload, it will be helpful

    Thank you.

    opened by LAnders0n 10
  • Unable to configure api auth middleware in apiato, laravel application

    Unable to configure api auth middleware in apiato, laravel application

    Hi,

    I have installed and configured RTippin Messenger with Laravel and apiato framework. But when I test "api/messenger" endpoint, it shows 401 status. I have also tried to config "api:auth" middleware that is used on our other endpoints. I shall be grateful to you if you kindly guide me in this issue.

    kind Regards, Hassan

    opened by hassanexcelorithm 10
  • How to fix this 403 Forbidden Permission to access Error in my case ?

    How to fix this 403 Forbidden Permission to access Error in my case ?

    Hi.

    Unable to connect to my site (https://msg.worklx.com/) Laravel, I get the error: Forbidden You don’t have permission to access this resource.

    IMPORTANT: I specify that I cloned and indeed installed via "composer" all the dependencies of the Demo Version of RTippin/messenger (https://github.com/RTippin/messenger-demo) and even installed the components of the Demo in question via php artisan demo:install.

    So how to fix it ??? I really need your help.

    opened by chegmarco1989 8
  • New messages do not appear on receiver screen without refresh

    New messages do not appear on receiver screen without refresh

    Hello.

    I want to congratulate you for the great job. I managed to make it work with my Laravel project, but for some reason new messages are not showing on receiver screen until page is refreshed. I can see the icon when the other user is typing but not the message itself.

    opened by kirovelikov 6
  • xxxxxxx could not be authenticated to private-messenger.user.xxxx

    xxxxxxx could not be authenticated to private-messenger.user.xxxx

    Hi, I still have a lot of issue to add your package to my project. It's exactly what I'm looking for, so I don't want to give up ! I tried to use your demo, but I still have an issue with Laravel Echo server. I followed all the doc to make sure I copy paste the appId/Key from Laravel-echo-server.json to the .env ... but I still have an error :/

    `

    sylvain@MBP-de-Sylvain messenger-demo-master % laravel-echo-server start

    L A R A V E L E C H O S E R V E R

    version 1.6.2

    ⚠ Starting server in DEV mode...

    ✔ Running at localhost on port 6001 ✔ Channels are ready. ✔ Listening for http events... ✔ Listening for redis events...

    Server ready!

    [19:23:16] - Preparing authentication request to: http://localhost:8000 [19:23:16] - Sending auth request to: http://localhost:8000/api/broadcasting/auth

    ⚠ [19:23:16] - lMUUODNNsfLdEssOAAAG could not be authenticated to private-messenger.user.932a7ac2-2b7c-409b-be43-110e8055b12a {"message":"Unauthenticated."} Client can not be authenticated, got HTTP status 401 [19:23:16] - Preparing authentication request to: http://localhost:8000 [19:23:16] - Sending auth request to: http://localhost:8000/api/broadcasting/auth

    ⚠ [19:23:16] - BG4LhvClClJ3FMKCAAAH could not be authenticated to private-messenger.user.932a7ac2-2b7c-409b-be43-110e8055b12a {"message":"Unauthenticated."} Client can not be authenticated, got HTTP status 401 [19:23:17] - Preparing authentication request to: http://localhost:8000 [19:23:17] - Sending auth request to: http://localhost:8000/api/broadcasting/auth

    ⚠ [19:23:17] - IlWDQbzsyuzSM1EcAAAI could not be authenticated to private-messenger.user.932a7ac2-2b7c-409b-be43-110e8055b12a {"message":"Unauthenticated."} Client can not be authenticated, got HTTP status 401 Channel: private-messenger.user.932a7ac2-2b7c-409b-be43-110e8055b12a Event: thread.read Channel: private-messenger.user.932a7ac2-2b7c-409b-be43-110e8055b12a Event: thread.read Channel: private-messenger.user.932a7ac2-2b7c-409b-be43-110e8055b12a Event: thread.read `

    It's driving me crazy because all the rest works perfectly.

    thanks for your work and your help !

    opened by lps83 5
  • Messenger (USer model) fields

    Messenger (USer model) fields

    Thanks for this wonderful package.

    Currently package returns all fields of our 'User' model. This includes phone numbers etc also. How can we modify the 'Base' response object?

    opened by vishalag991 2
  • The given provider { App\Models\User } must implement the interface RTippin\Messenger\Contracts\MessengerProvider

    The given provider { App\Models\User } must implement the interface RTippin\Messenger\Contracts\MessengerProvider

    This is my USER Model ---

    use Illuminate\Database\Eloquent\Builder; use RTippin\Messenger\Contracts\MessengerProvider; use RTippin\Messenger\Traits\Messageable;

    use Illuminate\Notifications\Notifiable; use Laravel\Passport\HasApiTokens;

    class User extends Authenticatable implements MessengerProvider {
    //Default trait to satisfy MessengerProvider interface use SoftDeletes, Notifiable, HasApiTokens, Messageable;

    Error When run command -- php artisan serve or run any command

    InvalidArgumentException

    The given provider { App\Models\User } must implement the interface RTippin\Messenger\Contracts\MessengerProvider

    at vendor/rtippin/messenger/src/Messenger.php:92 88▕ } 89▕ 90▕ foreach ($providers as $provider) { 91▕ if (! is_subclass_of($provider, MessengerProvider::class)) { ➜ 92▕ throw new InvalidArgumentException("The given provider { $provider } must implement the interface ".MessengerProvider::class); 93▕ } 94▕ 95▕ $this->providers[$provider] = new MessengerProviderDTO($provider); 96▕ }

      +1 vendor frames 
    

    2 app/Providers/MessengerServiceProvider.php:28 Illuminate\Support\Facades\Facade::__callStatic("registerProviders")

    opened by tapang786 2
  • Not finding my existing users

    Not finding my existing users

    Discussed in https://github.com/RTippin/messenger/discussions/47

    Originally posted by enanwangai August 30, 2022 Hi, I need assistance I am pretty new t this package and I am unable to display or search the users from the messenger platform. What could be the issue? I already have users in this existing model... image

    opened by enanwangai 1
  • API explorer at https://tippindev.com/api-explorer: Page not loading

    API explorer at https://tippindev.com/api-explorer: Page not loading

    Please check the app you have linked in the documentation. The API explorer is not opening up, in fact the entire site seems to be down.

    It'd be great if I could see the demo app in action along with the API documentation.

    Cheers!

    opened by craftisan 1
  • How to search in all users? And add participants in a group?

    How to search in all users? And add participants in a group?

    1. How can a user search all users (including new fresh users) for conversations?

    In the users table

    Getting only logged in user

    I want to get search results from all new users. Logged in or not.

    in user model

    Implements

    class User extends Authenticatable implements MessengerProvider
    

    Using traite

    use Messageable;
    

    Setting method

       public static function getProviderSettings(): array
        {
            return [
                'alias' => 'user',
                'searchable' => true,
                'friendable' => true,
                'devices' => true,
                'default_avatar' => public_path('vendor/messenger/images/users.png'),
                'cant_message_first' => [],
                'cant_search' => [],
                'cant_friend' => [],
            ];
        }
    

    Searchable method

       public static function getProviderSearchableBuilder(
            Builder $query,
            string $search,
            array $searchItems
        ) {
            $query->where(function (Builder $query) use ($searchItems) {
                foreach ($searchItems as $item) {
                    $query->orWhere('name', 'LIKE', "%{$item}%");
                }
            })->orWhere('email', '=', $search);
        }
    

    2. How can users add participants in a group without being friends?

    I am using BIGINT id in the users table

    opened by arifbsl 1
  • Initial POC of Message Type provider system

    Initial POC of Message Type provider system

    This is a POC where message types are moved into service provider/facade allowing for the expansion of the type system by implementing system.

    This isn't complete but the tests are passing!

    What's been done:

    Message type specific Resource data methods have been moved into type classes. This removes type-specific code from the resource.

    Most of the hardcoded references to type codes have been removed and replaced with a Facade getter.

    Definitions for system and non-system types are now defined in the MessageType repository.

    Relevant tests have been updated.

    There are a number of bits and pieces for the document/audio/image types which haven't been moved over and might require a bit more thought as to how they are going to be handled. Things like ->isImage() shouldn't be necessary, but should be handled better.

    There are a handful of Message::* for non-system messages that haven't been touched yet. I just don't want to flesh everything else out if this isn't a good direction.

    opened by nvahalik 4
Releases(v1.21.0)
Owner
Richard Tippin
Open Source. PHP. Laravel. Crafting helpful tools that can bring people together.
Richard  Tippin
Laravel-veneer - A suite of mocked services to use in your Laravel tests.

Laravel Veneer A suite of fixture data and methods to help make mocking 3rd party services easier. Overview Laravel Veneer aims to solve two problems

Oh See Software 4 Jun 23, 2022
Live Helper Chat - live support for your website. Featuring web and mobile apps, Voice & Video & ScreenShare. Supports Telegram, Twilio (whatsapp), Facebook messenger including building a bot.

Live helper chat It's an open-source powered application, which brings simplicity and usability in one place. With live helper chat you can bring live

Live Helper Chat 1.7k Dec 29, 2022
Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.

Laravel Migrations Generator Generate Laravel Migrations from an existing database, including indexes and foreign keys! This package is cloned from ht

Kit Loong 1.4k Jan 1, 2023
This package adds support for verifying new email addresses: when a user updates its email address, it won't replace the old one until the new one is verified.

Laravel Verify New Email Laravel supports verifying email addresses out of the box. This package adds support for verifying new email addresses. When

Protone Media 300 Dec 30, 2022
Simple project to send bulk comma-separated emails using laravel and messenger module from quick admin panel generator.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Novath Thomas 1 Dec 1, 2021
For using Laravel with a pre-existing MySQL Database

MySQL to Laravel This is a script to help with mapping an existing MySQL database to a new Laravel build. Place the script in the public folder of you

Chad Haney 17 Nov 29, 2022
A full-featured Laravel package for aiding in Shopify App development

Laravel Shopify App A full-featured Laravel package for aiding in Shopify App development, similar to shopify_app for Rails. Works for Laravel 7 and u

Tyler King 1.2k Dec 19, 2022
A full-featured Laravel package for aiding in Shopify App development

Laravel Shopify App A full-featured Laravel package for aiding in Shopify App development, similar to shopify_app for Rails. Works for Laravel 7 and u

Tyler King 1.2k Jan 1, 2023
Foreman is a Laravel scaffolding application that automates common tasks you typically perform with each new Laravel app you create

Foreman is a Laravel scaffolding application that automates common tasks you typically perform with each new Laravel app you create. The directives you want Forman to perform are outlined in a JSON based template file.

Indatus 145 Apr 13, 2022
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.

Webdevetc BlogEtc - Complete Laravel Blog Package Quickly add a blog with admin panel to your existing Laravel project. It has everything included (ro

WebDevEtc. 227 Dec 25, 2022
Bring multi themes support to your Laravel application with a full-featured Themes Manager

Introduction hexadog/laravel-themes-manager is a Laravel package which was created to let you developing multi-themes Laravel application. Installatio

hexadog 86 Dec 15, 2022
Electrik is a full-featured, open-source, starter-kit to help you build you your SaaS application.

Electrik Electrik is a full-featured and open-source stater-kit for for your next SaaS application. It's built on top of Laravel, Livewire, neerajsoha

Electrik 129 Dec 31, 2022
A simple blog app where a user can signup , login, like a post , delete a post , edit a post. The app is built using laravel , tailwind css and postgres

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Nahom_zd 1 Mar 6, 2022
A web app for detecting backend technologies used in a web app, Based on wappalyzer node module

About Techdetector This a web fingerprinting application, it detects back end technologies of a given domain by using the node module wappalyzer. And

Shobi 17 Dec 30, 2022
CV-Resumes-App is helped us to build resume .. you can help me to improve this app...

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Eng Hasan Hajjar 2 Sep 30, 2022
Laravel-OvalFi helps you Set up, test, and manage your OvalFi integration directly in your Laravel App.

OvalFi Laravel Package Laravel-OvalFi helps you Set up, test, and manage your OvalFi integration directly in your Laravel App. Installation You can in

Paul Adams 2 Sep 8, 2022
Podcastwala - Your very own Podcast web app built with Laravel. Manage and listen to your favorite podcasts

Podcastwala Your very own Podcast web app built with Laravel 5. This web app enables you to manage RSS feeds for your favorite podcasts and listen to

null 142 Sep 14, 2022
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

Livewire 17.7k Jan 1, 2023
Laravel Livewire full page component routing.

Laravel Livewire Routes Laravel Livewire full page component routing. This package allows you to specify routes directly inside your full page Livewir

null 22 Oct 6, 2022