Download the PHP package martinko366/laravel-db-chat without Composer

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

Laravel DB Chat

Tests Code Style Latest Stable Version Total Downloads License PHP Version Require

A database-driven chat package for Laravel with long-polling support. No Redis, Pusher, or external services required - everything runs on your existing database.

Features

Installation

Install the package via Composer:

Publish the configuration and migrations:

Run the migrations:

Configuration

The package configuration file is located at config/dbchat.php. You can customize:

Usage

Authentication

The package uses Laravel Sanctum by default. Ensure you have authentication configured:

API Endpoints

All endpoints are prefixed with /api/dbchat by default.

Create a Conversation

POST /api/dbchat/conversations

For group chats:

Response:

List Conversations

GET /api/dbchat/conversations

Returns all conversations for the authenticated user.

Get Conversation Details

GET /api/dbchat/conversations/{id}

Send a Message

POST /api/dbchat/conversations/{id}/messages

Response:

Get Messages

GET /api/dbchat/conversations/{id}/messages?before_message_id=100&limit=50

Fetch historical messages with pagination.

Long Polling for New Messages

GET /api/dbchat/poll?after_message_id=523

This endpoint will wait up to 25 seconds (configurable) for new messages. Returns:

Response (200):

Mark Message as Read

POST /api/dbchat/messages/{id}/read

Returns 204 No Content on success.

Client Implementation Example

Here's a simple JavaScript client for long polling:

Vue/React Component Example

Here's a basic Vue 3 composition example:

How It Works

The Polling Mechanism

  1. Client keeps track of lastMessageId (starts at 0)
  2. Client calls /poll?after_message_id=X
  3. Server queries for messages with id > X
  4. If messages exist, return immediately
  5. If no messages, wait up to 25 seconds, checking every 500ms
  6. Return 204 No Content if timeout reached
  7. Client updates lastMessageId and polls again

Database Schema

conversations

participants

messages

message_reads

Performance Tips

  1. The package uses indexed queries with monotonic IDs for efficient polling
  2. Direct conversations are deduplicated automatically
  3. Use the before_message_id parameter for pagination
  4. Configure rate limits based on your needs
  5. Adjust polling timeout and check interval for your use case

Environment Variables

Advanced: SSE (Server-Sent Events)

If you prefer SSE over long polling, you can create a custom controller:

Testing

Security

License

MIT License

Credits

Created by Martinko366

Support

For issues and questions, please use the GitHub issue tracker.


All versions of laravel-db-chat with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0
illuminate/database Version ^10.0|^11.0
illuminate/http Version ^10.0|^11.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 martinko366/laravel-db-chat contains the following files

Loading the files please wait ...