cline/states 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cline/states

最新稳定版本:1.0.0

Composer 安装命令:

composer require cline/states

包简介

Multi-state management for any object with context, boundary, environment isolation, and full transition history.

README 文档

README

GitHub Workflow Status Latest Version on Packagist Software License Total Downloads

A flexible state management package for Laravel that allows any model or object to have multiple states with full transition history, context isolation, and environment support.

Features

  • Multiple States Per Object - Assign unlimited states to any context
  • Namespaced States - Organize states with optional namespaces (e.g., workflow.pending)
  • Context & Boundary Scoping - Isolate states by context and optional boundary
  • Environment Support - Separate states across environments (production, staging, etc.)
  • Full Transition History - Track every state change with actor, reason, and metadata
  • State Machine Validation - Configure allowed transitions per context type
  • Fluent API - Chainable conductor-based operations
  • 100% Test Coverage - Comprehensive test suite with PHPStan max level

Requirements

Requires PHP 8.4+ and Laravel 11+

Installation

composer require cline/states

Publish the migration and run it:

php artisan vendor:publish --tag="states-migrations"
php artisan migrate

Optionally publish the config file:

php artisan vendor:publish --tag="states-config"

Quick Start

use Cline\States\Facades\States;

// Assign a state
$user = User::find(1);
States::for($user)->assign('active');

// Transition between states
States::for($user)
    ->by($admin)
    ->because('User completed onboarding')
    ->transition('pending', 'active');

// Check states
States::hasState($user, 'active'); // true

// Get all states
$states = States::getStates($user);

Documentation

Change log

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please use the GitHub security reporting form rather than the issue queue.

Credits

License

The MIT License. Please see License File for more information.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-29