Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

State Laravel Package

karriere/state

A Laravel state machine for Eloquent models. Define states and transitions, guard changes, fire events, and keep a history of every transition—ideal for orders, payments, approvals, and other workflow-driven records.

View on GitHub
Deep Wiki
Context7

karriere/state is a lightweight state machine for Laravel applications. It lets you define states and allowed transitions, attach them to Eloquent models, and move records through a controlled lifecycle without scattering status logic across your codebase.

  • Define states and transitions declaratively.
  • Integrate seamlessly with Eloquent models.
  • Guard transitions and validate state changes.
  • Fire events/hooks for side effects and auditing.
  • Keep state logic centralized and testable.
Frequently asked questions about State
How do I install karriere/state in a Laravel application?
Install the package with Composer using composer require karriere/state. Laravel package discovery should register the service provider automatically, and you may optionally publish configuration if the package documentation provides it. Before production use, verify supported Laravel and PHP versions and wrap the package behind an internal interface so application code is not tightly coupled.
Which Laravel and PHP versions does karriere/state support?
The supplied context does not include a clear Laravel or PHP compatibility matrix, so check the package composer.json and README before installing. Pin a tested version and record the exact Laravel, PHP, cache driver, and session driver combination in your own compatibility matrix. Run a staging proof of concept against your application version before relying on it.
What license does karriere/state use, and is it safe for production?
The package is flagged with NOASSERTION, which means the actual license requires legal review before production use. Do not assume it is MIT or another permissive license. Avoid deep coupling until legal confirms whether forking, modification, and redistribution are allowed, and keep an exit plan if the license is unsuitable.
What is karriere/state used for compared with a database-backed state machine?
It fits ephemeral, per-user or per-session state such as onboarding wizards, multi-step forms, checkout progress, and short-lived UI state. It is not a system of record and should not be used for durable, auditable, cross-service, or business-critical domain state. For approval flows or order statuses that must survive cache eviction and audits, prefer database-backed workflow state unless the data is purely transient.
Which cache and session drivers work with karriere/state?
The package inherits behavior from Laravel's cache and session backends, so compatibility depends on the drivers you deploy. Test explicitly with Redis, database, file, or cookie-backed sessions rather than assuming identical behavior. Pay particular attention to TTL handling, serialization, multi-instance consistency, and whether file sessions are safe in your deployment topology.
How do I isolate state per user, tenant, or session in karriere/state?
Isolation depends on how cache or session keys are scoped in your application, so design user and tenant prefixes deliberately. Wrap the package behind an internal StateStore interface that enforces key naming and prevents application code from calling the package directly. Add tests that check cross-user and cross-tenant reads cannot leak state.
How does karriere/state handle TTL, eviction, and concurrent updates?
Because state lives in Laravel cache or session storage, cache outages and TTL eviction can cause state loss and user-flow resets. Set explicit TTLs, keep stored payloads small, and avoid using the package for long-lived or high-volume state. The supplied context does not guarantee atomic concurrent updates, so verify behavior and add locking or conflict handling where needed.
Can I use karriere/state with Laravel Octane or queue workers?
You must validate it against your exact Octane, Swoole, queue worker, and session configuration before adopting it. Confirm the package does not assume a request-bound session lifecycle in long-running workers. Pin a tested version and include Octane and queue scenarios in your contract tests if those are part of production.
How should I test a Laravel flow that uses karriere/state?
Write contract tests for TTL behavior, key isolation, serialization, cache failures, and state loss. Use Laravel's fake cache and session facilities to simulate eviction and outages without relying on production infrastructure. Because the package sits behind your own StateStore wrapper, you can mock the wrapper in feature tests and keep flow tests focused on behavior.
What are alternatives to karriere/state, and how do I migrate away?
Alternatives include first-party Laravel session and cache code, database-backed workflow state, or more established workflow packages. To migrate, wrap karriere/state behind an internal StateStore interface, pilot it on one non-critical flow, map existing session and cache keys, and roll out behind a feature flag. Do not dual-write production state without a defined rollback path, and keep an exit plan to replace it with first-party code.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections