NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

JSON resources are provided for building a messaging API or an Inertia/SPA backend. They expose only safe fields, render read state and reply info, and degrade gracefully when relations are not eager-loaded:

use RoundlyConsulting\Messages\Facades\Messages;
use RoundlyConsulting\Messages\Http\Resources\MessageResource;
use RoundlyConsulting\Messages\Http\Resources\ParticipantResource;
use RoundlyConsulting\Messages\Http\Resources\ThreadResource;

return ThreadResource::collection(Messages::inboxFor($request->user()));
return MessageResource::collection(Messages::thread($thread)->messages());

Fields

ResourceFields
ThreadResourceid, name, is_direct, is_public, is_archived, last_activity_at, unread_count (when present, e.g. from the inbox), latest_message and participants (when loaded).
MessageResourceid, thread_id, type, body (null once unsent), preview, is_deleted, sender (participateAs(), when loaded), reply_to (id, excerpt, sender_id, sender_type), sent_at, edited_at (text messages only).
ParticipantResourceid, role, read_at, joined_at, participant (participateAs(), or id + type when the model does not implement the interface).

Pair ThreadResource with Messages::inboxFor() — the inbox already eager-loads everything the resource reads, including unread_count. Both paginators follow the request’s ?page=, so the envelope’s meta.current_page and links.next stay in step for an infinite-scroll client.

Customising

Publish editable copies — ThreadResource, MessageResource and ParticipantResource in App\Http\Resources\Messages (app/Http/Resources/Messages):

php artisan vendor:publish --tag="messages-resources"

They render exactly what the package’s resources render until you edit them; use them instead of the package classes in your controllers. ThreadResource renders its latest message and participants through your copies too.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.