PHPackages                             roddy/stateforge - 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. [Framework](/categories/framework)
4. /
5. roddy/stateforge

ActiveLibrary[Framework](/categories/framework)

roddy/stateforge
================

Elegant, simple state management for Laravel applications.

v1.1.2(5mo ago)57MITPHPPHP ^8.0

Since Nov 29Pushed 5mo agoCompare

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

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

StateForge 🔥
============

[](#stateforge-)

> **Elegant, Isolated State Management for Laravel**

[![Latest Version](https://camo.githubusercontent.com/fefe45d5257ab75dd8d1a2c7847fccfb6adbe597a1fd052f7bae051917ee4c1d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f6464792f7374617465666f7267652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/roddy/stateforge)[![License](https://camo.githubusercontent.com/d129b6def27b17eba5e7709b838990fd7879decefac6fafae2728e5db2cf3aa1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f726f6464792f7374617465666f7267652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/roddy/stateforge)

StateForge is a powerful, elegant state management package for Laravel that provides isolated, persistent state stores with automatic discovery and multiple persistence options. Built with developer experience in mind, it brings the simplicity of client-side state management to your Laravel applications.

📖 Table of Contents
-------------------

[](#-table-of-contents)

- [Features](#-features)
- [Installation](#-installation)
- [Quick Start](#-quick-start)
- [Core Concepts](#-core-concepts)
- [Store Lifecycle](#-store-lifecycle)
- [Store Examples](#-store-examples)
- [Events &amp; Hooks](#-events--hooks)
- [API Reference](#-api-reference)
- [Persistence Options](#-persistence-options)
- [Advanced Usage](#-advanced-usage)
- [Configuration](#-configuration)
- [Maintenance](#-maintenance)
- [Best Practices](#-best-practices)
- [Troubleshooting](#-troubleshooting)
- [FAQ](#-faq)
- [Contributing](#-contributin)
- [License](#-license)

✨ Features
----------

[](#-features)

- 🚀 **Auto-discovery** - Stores automatically discovered and registered
- 🔒 **User Isolation** - Each browser/user gets completely isolated stores
- 💾 **Multiple Persistence** - File, cache, session, or in-memory storage
- 🎯 **Type Safety** - Use class references instead of magic strings
- 🔄 **Persistence Across Sessions** - State survives browser restarts
- 🧩 **Lifecycle Hooks** - `onUpdate()` for automatic state change handling
- 🔌 **Custom Middlewares** - Extend store behavior with middleware arrays
- 🎭 **Event System** - Before/after hooks and global events
- 🛠 **Artisan Commands** - Generate stores and manage cleanup
- 📦 **Zero Configuration** - Works out of the box with sensible defaults
- 🔍 **Browser Fingerprinting** - Fallback identification when cookies are cleared
- 🛡️ **Data Integrity** - Checksum verification for persisted data

🚀 Installation
--------------

[](#-installation)

### Requirements

[](#requirements)

- PHP 8.0 or higher
- Laravel 9.0 or higher

### Install via Composer

[](#install-via-composer)

```
composer require roddy/stateforge
```

### Publish Configuration (Optional)

[](#publish-configuration-optional)

```
php artisan vendor:publish --provider="Roddy\\StateForge\\StateForgeServiceProvider" --tag=stateforge-config
```

🎯 Quick Start
-------------

[](#-quick-start)

### 1. Create Your First Store

[](#1-create-your-first-store)

```
php artisan make:store Counter
```

This creates `app/Stores/CounterStore.php` with the enhanced architecture:

```
