Download the PHP package musonza/chat without Composer

On this page you can find all versions of the php package musonza/chat. 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 chat

Build Status Downloads Packagist

Chat

Create a Chat application for your multiple Models


What to learn how to make a package like this? https://leanpub.com/laravel-package-development


Table of Contents

Click to expand

- [Introduction](#introduction) - [Installation](#installation) - [Usage](#usage) - [Adding the ability to participate to a Model](#Adding-the-ability-to-participate-to-a-Model) - [Get participant details](#get-participant-details) - [Creating a conversation](#creating-a-conversation) - [Get a conversation by Id](#get-a-conversation-by-id) - [Update conversation details](#update-conversation-details) - [Send a text message](#send-a-text-message) - [Send a message of custom type](#send-a-message-of-custom-type) - [Get a message by id](#get-a-message-by-id) - [Get message sender](#Get-message-sender) - [Mark a message as read](#mark-a-message-as-read) - [Mark whole conversation as read](#mark-whole-conversation-as-read) - [Unread messages count](#unread-messages-count) - [Delete a message](#delete-a-message) - [Cleanup Deleted Messages](#cleanup-deleted-messages) - [Clear a conversation](#clear-a-conversation) - [Get participant conversations](#Get-participant-conversations) - [Get a conversation between two participants](#get-a-conversation-between-two-participants) - [Get common conversations among participants](#get-common-conversations-among-participants) - [Remove participants from a conversation](#remove-participants-from-a-conversation) - [Add participants to a conversation](#add-participants-to-a-conversation) - [Get messages in a conversation](#get-messages-in-a-conversation) - [Get recent messages](#get-recent-messages) - [Get participants in a conversation](#get-participants-in-a-conversation) - [Get participation entry for a Model in a conversation](#Get-participation-entry-for-a-Model-in-a-conversation) - [Update participation settings](#Update-participation-settings) - [Data Transformers](#Data-Transformers) - [License](#license)

Checkout a simple Demo Application

Introduction

This package allows you to add a chat system to your Laravel ^5.4 application

Installation

From the command line, run:

Publish the assets:

This will publish database migrations and a configuration file musonza_chat.php in the Laravel config folder.

Configuration

See musonza_chat.php for configuration

Run the migrations:

Usage

You can mix Models as participants. For instance you can have Parents, Students and Professors models communicating

Adding the ability to participate to a Model

Add the Musonza\Chat\Traits\Messageable trait to any Model you want to participate in Conversations For example, let's say we want out Bot model to chat with other Models:

Get participant details

Since we allow Models with data that differ in structure to chat, we may want a uniform way to represent the participant details in a uniform way.

You can get the details as follows:

Assuming you have a column name for your model, this returns a default array ['name' => 'column_value'] You can however, customize this for your needs by adding an Eloquent Accessor that returns an array with as much as you need to your model as follows:

Creating a conversation

You can start a conversation by passing an array of Models as participants

Creating a conversation of type private / public

You may want to classify conversations as private or public

Note: You will not be able to add additional participants to a direct conversation. Additionally you can't remove a participant from a direct conversation.

Get a conversation by id

Update conversation details

Send a text message

Send a message of custom type

The default message type is text. If you want to specify custom type you can call the type() function as below:

To add more details about a message

Sometimes you might want to add details about a message. For example, when the message type is an attachment, and you want to add details such as attachment's filename, and attachment's file url, you can call the data() function and pass your data as an array.

Get a message by id

Get message sender

Mark a message as read

Flag / mark a message

Mark whole conversation as read

Unread messages count

Unread messages count per Conversation

Delete a message

Cleanup Deleted Messages

What to cleanup when all participants have deleted a $message or $conversation?

Listen for \Musonza\Chat\Eventing\AllParticipantsDeletedMessage and

\Musonza\Chat\Eventing\AllParticipantsClearedConversation

Clear a conversation

Get participant conversations

Get a conversation between two participants

Get common conversations among participants

$participants is an array of participant Models

Remove participants from a conversation

Add participants to a conversation

Get messages in a conversation

Get user conversations by type

Get recent messages

Pagination

There are a few ways you can achieve pagination You can specify the limit and page as above using the respective functions or as below:

You don't have to specify all the parameters. If you leave the parameters out, default values will be used. $paginated above will return Illuminate\Pagination\LengthAwarePaginator To get the conversations simply call $paginated->items()

Get participants in a conversation

Get participation entry for a Model in a conversation

Update participation settings

Set Conversation settings for participant (example: mute_mentions, mute_conversation)

Data Transformers

Need to have more control on the data returned from the package routes? You can specify your own Model transformers and take advantage of Fractal.

All you need to do is specify the location of your transformers in the configuration file musonza_chat.php as follows:

Note: This only applies to responses from package routes.

License

Chat is open-sourced software licensed under the MIT license


All versions of chat with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
illuminate/contracts Version ^8.0|^9.0|^10.0|^11.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
spatie/laravel-fractal Version ^6.0|dev-main
laravel/legacy-factories Version ^1.0
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 musonza/chat contains the following files

Loading the files please wait ....