---
title: "Installation — Messages for Laravel | Roundly"
description: "Install via Composer, publish the publish-only migrations for messages and media-library, then migrate."
url: https://roundly-consulting.com/open-source/docs/messages-for-laravel/installation
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Messages for Laravel](https://roundly-consulting.com/open-source/docs/messages-for-laravel.md)

# Installation

Require the package. The service provider and the Messages facade alias are auto-discovered — no manual registration:

```bash
composer require roundly-consulting/messages-for-laravel
```

Composer also pulls in the three sibling packages Messages is built on — enums-for-laravel, media-library-for-laravel and package-toolkit-for-laravel. There is nothing to install or configure for them separately.

## Key type first

If your participating models (usually User) are keyed by uuid or ulid, set that before you migrate — it is baked into the schema (see Key types):

```bash
MESSAGES_KEY_TYPE=uuid   # bigint (default) | uuid | ulid — your models' primary key type
```

## Publish-only migrations

Migrations are not loaded automatically — a bare php artisan migrate creates nothing until you publish them. Messages stores attachments through media-library-for-laravel, installed with it, whose media table is publish-only too — publish both, then migrate:

```bash
php artisan vendor:publish --tag="media-migrations"
php artisan vendor:publish --tag="messages-migrations"
php artisan migrate
```

Skip media-migrations and the first send fails, because every send looks up the message’s attachments, whether or not it has any:

```
no such table: media
```

The eleven messages migrations land in database/migrations under timestamped filenames that preserve the order the tables depend on each other in, so they interleave correctly with your own. They create messaging\_threads, messaging\_participants and messaging\_messages — all with soft deletes and a configurable key type.

## Optional publishes

```bash
php artisan vendor:publish --tag="messages-config"
php artisan vendor:publish --tag="messages-translations"
php artisan vendor:publish --tag="messages-resources"
php artisan vendor:publish --tag="messages-notifications"
```

- messages-config — config/messages.php; every key has an env-backed default, so this is only needed to override.
- messages-translations — the system-message, preview and exception strings. English and Slovak ship with the package, so publish only to reword them or add a language.
- messages-resources — editable copies of the JSON API resources in App\\Http\\Resources\\Messages (app/Http/Resources/Messages).
- messages-notifications — an editable copy of the new-message notification in App\\Notifications\\Messages (app/Notifications/Messages).

## Next steps

- Implement ParticipatesInMessaging and add the HasMessaging trait to every model that sends or takes part.
- Open a DM with Messages::direct() or a group with Messages::start() — or the trait’s conversationWith() and startConversationWith().
- Optionally turn on broadcasting, notifications and system messages via env.

## 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](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## 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.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/messages-for-laravel.md)
