PHPackages                             andheiberg/messenger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. andheiberg/messenger

ActiveLibrary

andheiberg/messenger
====================

Basic messaging package for laravel

1.0.5(11y ago)691.6k14[2 issues](https://github.com/AndreasHeiberg/laravel-messenger/issues)PHP

Since Feb 9Pushed 9y ago6 watchersCompare

[ Source](https://github.com/AndreasHeiberg/laravel-messenger)[ Packagist](https://packagist.org/packages/andheiberg/messenger)[ RSS](/packages/andheiberg-messenger/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (8)Used By (0)

Laravel Messenger
=================

[](#laravel-messenger)

Basic Messaging System for Laravel4

Introduction
------------

[](#introduction)

The main purpose of this package is providing an suited Foundation for extended communication platforms, based on laravel 4 (or compatible frameworks).

Overview
--------

[](#overview)

You have many users and they want to chat? Couldn't be simplier!

- Participants have many conversations
- A conversation belongs to many participants
- A message belongs to a single conversation
- A conversation consists of many Messages
- Participants latest read timestamp is stored

Installation
------------

[](#installation)

- Add `"andheiberg/messenger": "dev-master"` to your composer.json
- Run `composer update`
- Add `'Andheiberg\Messenger\MessengerServiceProvider',` to `app/config/app.php` under `providers`
- Run `php artisan messenger:setup`
- Add `use \Andheiberg\Messenger\Traits\UserCanMessage;` inside your User model class

Usage
-----

[](#usage)

Congratulations! Now you can use the laravel4 messenger.

`php artisan messenger:setup` will publish a Conversation and a Message model to app/models. If you prefer to make them your self, just extend Pichkrement\\Messenger\\Models\\Conversation and Pichkrement\\Messenger\\Models\\Message.

### Examples

[](#examples)

Now you can use it like a pro.

```
    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
        $user = Auth::user();
        $conversations = Conversation::forUser()->get();

        if ($conversations->isEmpty())
        {
            return Redirect::route('conversations.create');
        }

        return Redirect::route('conversations.show', [$conversations->last()->id]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return Response
     */
    public function create()
    {
        $user = Auth::user();
        $conversations = Conversation::forUser()->orderBy('updated_at', 'desc')->get();

        return View::make('conversations.create', compact('conversations'));
    }

    /**
     * Store a newly created resource in storage.
     *
     * @return Response
     */
    public function store()
    {
        $input = Input::all();

        $conversation = Conversation::create([
            'subject' => $input['subject'],
        ]);

        $message = Message::create([
            'conversation_id' => $conversation->id,
            'user_id' => Auth::user()->id,
            'body' => $input['message'],
        ]);

        $sender = Participant::create([
            'conversation_id' => $conversation->id,
            'user_id' => Auth::user()->id
        ]);

        if ($this->input->has('recipient'))
        {
            $recipient = User::where('email', $input['recipient'])->first();
            Participant::create([
                'conversation_id' => $conversation->id,
                'user_id' => $recipient->id,
            ]);
        }

        return Redirect::route('conversations.index');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return Response
     */
    public function show($id)
    {
        $user = Auth::user();
        $conversations = Conversation::forUser()->orderBy('updated_at', 'desc')->get();
        $conversation  = Conversation::find($id);

        // $me = Participant::me()->where('conversation_id', $conversation->id)->first();
        // $me->last_read = new DateTime;
        // $me->save();

        return View::make('conversations.show', compact('conversations', 'conversation'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return Response
     */
    public function createMessage($conversation)
    {
        return View::make('conversations.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @return Response
     */
    public function storeMessage($conversation)
    {
        $message = Message::create([
            'conversation_id' => $conversation,
            'user_id' => $this->auth->user()->id,
            'body' => $this->input->input('message'),
        ]);

        return Redirect::route('conversations.show', $conversation);
    }
```

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 64.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~47 days

Total

7

Last Release

4282d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/207626c3611f7c70c59a8164259c22cb1233b0a8e009d1feae3e45c9351d4c4c?d=identicon)[AndreasHeiberg](/maintainers/AndreasHeiberg)

---

Top Contributors

[![inkrement](https://avatars.githubusercontent.com/u/604528?v=4)](https://github.com/inkrement "inkrement (34 commits)")[![DomPich](https://avatars.githubusercontent.com/u/2458994?v=4)](https://github.com/DomPich "DomPich (17 commits)")[![andheiberg](https://avatars.githubusercontent.com/u/820962?v=4)](https://github.com/andheiberg "andheiberg (1 commits)")[![bryant1410](https://avatars.githubusercontent.com/u/3905501?v=4)](https://github.com/bryant1410 "bryant1410 (1 commits)")

### Embed Badge

![Health badge](/badges/andheiberg-messenger/health.svg)

```
[![Health](https://phpackages.com/badges/andheiberg-messenger/health.svg)](https://phpackages.com/packages/andheiberg-messenger)
```

###  Alternatives

[api-platform/laravel

API Platform support for Laravel

59126.4k5](/packages/api-platform-laravel)[reachweb/statamic-livewire-filters

Livewire filters for Statamic collections.

1710.5k](/packages/reachweb-statamic-livewire-filters)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
