anwar/laravel-support

Support conversations and messaging module

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/anwar/laravel-support

0.0.1 2026-02-04 16:43 UTC

This package is auto-updated.

Last update: 2026-02-04 16:48:46 UTC


README

License PHP

A lightweight, production-ready Laravel package that provides support conversations and messaging features (conversations, messages, agents, guests, assignments, reads and broadcasting support channels).

Table of Contents

Highlights βœ…

  • Conversation lifecycle: create, reply, assign, close
  • Message read tracking and assignment history
  • Guest support with configurable guards and rate-limits
  • Built-in Broadcast channels and events for real-time UIs
  • Policy-based authorization for agents and supervisors
  • Auto-registers as a Laravel provider (PSR-4: Anwar\\Support\\)

Requirements πŸ”§

  • PHP >= 8.1
  • Laravel 10.x (or compatible 10.x series)
  • Illuminate components: database, broadcasting, queue, support

Installation πŸ“¦

For a published package on Packagist:

composer require anwar/laravel-support

For local development in a monorepo, add to your root composer.json:

"repositories": [
  {
    "type": "path",
    "url": "packages/support"
  }
]

Then require the package (example for local dev):

composer require anwar/laravel-support:dev-main --prefer-source

The package supports Laravel's package auto-discovery. To register manually, add this to config/app.php providers:

Anwar\Support\SupportServiceProvider::class,

Publish config

php artisan vendor:publish --provider="Anwar\Support\SupportServiceProvider" --tag=support-config

Migrate database

The package loads its own migrations automatically. Run:

php artisan migrate

Configuration βš™οΈ

Configuration file: config/support.php

Key configuration options include:

  • table_prefix β€” prefix for package tables (default support_)
  • user_model β€” your User model class
  • guards β€” customer and agent guard settings
  • middleware β€” middleware groups for customer/agent APIs
  • roles β€” agent and supervisor role names
  • permissions β€” permission names view_inbox and view_all
  • guest.enabled β€” allow guest conversations
  • rate_limits β€” customer/guest per-minute messaging throttles

Adjust these with your application environment variables (see SUPPORT_*).

Usage 🧭

Routes / API

Routes are registered under the /support prefix (see src/Routes/api.php).

Customer-facing routes (middleware support.middleware.customer):

  • POST /support/conversations β€” Create a conversation
  • GET /support/conversations/{conversation} β€” Show conversation
  • POST /support/conversations/{conversation}/messages β€” Add a message (throttled)
  • POST /support/conversations/{conversation}/read β€” Mark as read
  • POST /support/conversations/{conversation}/typing β€” Typing indicator

Agent routes (middleware support.middleware.agent):

  • GET /support/agent/inbox β€” Agent inbox
  • GET /support/agent/conversations/{conversation} β€” Show conversation
  • POST /support/agent/conversations/{conversation}/assign β€” Assign conversation
  • POST /support/agent/conversations/{conversation}/close β€” Close conversation
  • POST /support/agent/conversations/{conversation}/note β€” Add internal note

Broadcast channels

Defined in src/Routes/channels.php:

  • support.conversation.{conversationId} β€” conversation updates
  • support.user.{userId} β€” direct user notifications
  • support.agents β€” agent/supervisor notifications

Authorization is delegated to Anwar\Support\Services\SupportAccess.

Events

The package emits events for your real-time frontend:

  • SupportConversationCreated β€” new conversation
  • SupportMessageCreated β€” new message
  • SupportMessageRead β€” message read update
  • SupportConversationAssigned β€” conversation assignment
  • SupportConversationUpdated β€” conversation metadata/status update
  • SupportTyping β€” typing on/off

Each event is broadcasted to relevant channelsβ€”subscribe on the client to update conversation lists and messages in real-time.

Models

  • Anwar\Support\Models\Conversation
  • Anwar\Support\Models\Message
  • Anwar\Support\Models\Participant
  • Anwar\Support\Models\Read
  • Anwar\Support\Models\Assignment
  • Anwar\Support\Models\Guest

Use the models directly or rely on the provided API controllers.

Testing & Development πŸ§ͺ

  • Run your application test suite from the project root (phpunit)
  • For local development, you may want to configure the package as a path repository (see installation) and run composer dump-autoload after changes

Good checks:

composer dump-autoload
php artisan migrate --seed
php artisan test

Contributing 🀝

Contributions are welcome.

  • Fork the repo
  • Create a feature branch
  • Add tests for new behavior
  • Send a pull request with a clear description

Please follow PSR-12 coding style and add unit/integration tests for new features.

License

MIT β€” see the LICENSE file.

Maintainers & Support

  • Maintainer: ringkubd (repository owner)
  • For issues and feature requests, please open an issue on the repository.

Base color for package branding: #CE4631

If you'd like, I can also add examples for a JavaScript/Livewire front-end to consume the package's broadcasted events and realtime channels. πŸ”§