mkd/laravel-state-management
Collection, Carbon, custom classes), reducing boilerplate.StoreContract.memory_get_usage()).Store::fake() if available.)store:make for new stateful services.Store::get()).boot() for lazy loading.spatie/laravel-activitylog).App\Stores\ActivityLogStore).php artisan vendor:publish --provider="MKD\StateManagement\StateManagementServiceProvider".php artisan store:make AuthStore.public function __construct(private UserStore $userStore) {}
Http::fake()).UserStore::resetPassword()).AuthStore, InventoryStore).store->set() over direct property manipulation.Store::all() to dump global state (caution: sensitive data).Arrayable or JsonSerializable.file driver) won’t sync across servers.php artisan state:stats if available).gzip for large objects.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Cache driver unavailable | State loss | Configure fallback (e.g., database). |
| Concurrent write conflicts | Data races | Use Store::lock() or Redis transactions. |
| Serialization errors | Store rehydration fails | Validate objects before storage. |
| Memory exhaustion | App crashes | Set memory limits; use smaller cache drivers. |
| Unintended state mutation | Bugs in unrelated components | Restrict store access via middleware/guards. |
PascalCase).How can I help you explore Laravel packages today?