PHPackages                             epessine/vessel - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. epessine/vessel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

epessine/vessel
===============

Global state for Laravel Livewire components

v0.2.0(1y ago)10111MITPHPPHP ^8.2|^8.3

Since Jun 1Pushed 1y ago2 watchersCompare

[ Source](https://github.com/epessine/vessel)[ Packagist](https://packagist.org/packages/epessine/vessel)[ RSS](/packages/epessine-vessel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (3)Used By (0)

 [![GitHub Workflow Status (main)](https://github.com/epessine/vessel/actions/workflows/tests.yml/badge.svg)](https://github.com/epessine/vessel/actions) [![Total Downloads](https://camo.githubusercontent.com/697af1fcc6326e2abdbfab97dee6f4af22d607d36104d546153e65eddeb5c72e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6570657373696e652f76657373656c)](https://packagist.org/packages/epessine/vessel) [![Latest Version](https://camo.githubusercontent.com/2ad5bad433fa09b732f5956051f519389c868153a10d9b2f01ba8754e074c3c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6570657373696e652f76657373656c)](https://packagist.org/packages/epessine/vessel) [![License](https://camo.githubusercontent.com/f8f2025ad94b792189c355ddbbb6c8db60df1a6144d2af36d9c3447a2bd66a3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6570657373696e652f76657373656c)](https://packagist.org/packages/epessine/vessel)

---

Vessel - global state for Livewire
==================================

[](#vessel---global-state-for-livewire)

Vessel provides a global state for [Livewire](https://livewire.laravel.com), allowing multiple components to share state without a multitude of events to handle interaction.

Just create a Vessel class, set it's properties and initialization and use it on your components.

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

[](#installation)

```
composer install epessine/vessel
```

No configuration needed.

Usage
-----

[](#usage)

Vessel works by creating 'vessel classes', where you define the properties that you global state will have:

```
use Vessel\BaseVessel;

class FilterVessel extends BaseVessel
{
    public string $selectedUserType = 'admin';
}
```

You can also initialize your properties using the `init()` method:

```
use Vessel\BaseVessel;

class FilterVessel extends BaseVessel
{
    public string $selectedUserType;

    public function init(): void
    {
        $this->selectedUserType = str('admin')->toString();
    }
}
```

Then use the Vessel on your components with the `Vessel\Attributes\Vessel` attribute. Take a look at the components below:

```
use Livewire\Component;
use Vessel\Attributes\Vessel;

/**
 * @property-read FilterVessel globalFilters
 */
class Filter extends Component
{
    #[Vessel]
    public function globalFilters(): string
    {
        return FilterVessel::class; // vessel class declared above
    }

    public function selectUserFilter(string $type): void
    {
        // here we change the vessel property value
        $this->globalFilters->selectedUserType = $type;
    }

    // ...
}
```

```
use Livewire\Component;
use Vessel\Attributes\Vessel;

/**
 * @property-read FilterVessel globalFilters
 */
class UserList extends Component
{
    #[Vessel]
    public function globalFilters(): string
    {
        return FilterVessel::class; // vessel class declared above
    }

    #[Computed]
    public function users(): array
    {
        // here we get the updated vessel property value
        User::query()
            ->where('type', $this->globalFilters->selectedUserType)
            ->get()
            ->all();
    }

    // ...
}
```

After calling `Filter::selectUserFilter()`, the `selectedUserType` will be updated on all components that use the same Vessel, and will reflect the change on the `UserList::users` computed property query, for example.

All of that without a single event dispatch/listener!

Updated Hook
------------

[](#updated-hook)

You can use the `updated` lifecycle hook on Vessel properties the same way as Livewire properties. The updated method name should include the Vessel method name as well. Let's rewrite the example above:

```
use Livewire\Component;
use Vessel\Attributes\Vessel;

/**
 * @property-read FilterVessel globalFilters
 */
class UserList extends Component
{
    public array $users;

    #[Vessel]
    public function globalFilters(): string
    {
        return FilterVessel::class; // vessel class declared above
    }

    public function updatedGlobalFiltersSelectedUserType(string $value): void
    {
        // here we get the updated vessel property value
        $this->users = User::query()->where('type', $value)->get()->all();
    }

    // ...
}
```

This way, whenever the `$selectedUserType` property on the `FilterVessel` class is updated on any component that uses it, the `updatedGlobalFiltersSelectedUserType` method will be called.

Troubleshooting
---------------

[](#troubleshooting)

There are some base rules when using Vessel:

- Vessel properties *cannot* be accessed/mutated on the front-end via `$wire`. You can create methods that can be called on the front-end to interact with the Vessel indirectly, though.
- Vessel properties are *'immutable'* so any changes inside the property will *not* reflect on other components. Always reassign the property after making changes.
- Vessel uses the application cache to operate and maintain state, so storing huge amounts of data on a Vessel can slow down your whole application.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

713d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9580d7d3326804d2c3645e40d2af38a8b6e5c7f9db919ce12da6bf0ccdc24a84?d=identicon)[epessine](/maintainers/epessine)

---

Top Contributors

[![epessine](https://avatars.githubusercontent.com/u/73755131?v=4)](https://github.com/epessine "epessine (12 commits)")

---

Tags

phplaravelpackageglobal statestatelivewire

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/epessine-vessel/health.svg)

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

###  Alternatives

[mediconesystems/livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS

1.2k711.3k8](/packages/mediconesystems-livewire-datatables)[okipa/laravel-table

Generate tables from Eloquent models.

56752.8k](/packages/okipa-laravel-table)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[asosick/filament-layout-manager

Allow users to create &amp; customize their own FilamentPHP pages composed of Livewire components

5718.8k2](/packages/asosick-filament-layout-manager)[arm092/livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS

2953.8k](/packages/arm092-livewire-datatables)[okipa/laravel-form-components

Ready-to-use and customizable form components.

198.0k1](/packages/okipa-laravel-form-components)

PHPackages © 2026

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