Download the PHP package rasuvaeff/yii3-workflow without Composer

On this page you can find all versions of the php package rasuvaeff/yii3-workflow. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii3-workflow

rasuvaeff/yii3-workflow

Stable Version Total Downloads Build Static analysis License

Yii3 integration for symfony/workflow: the wiring Symfony's FrameworkBundle provides, plus the two things the component deliberately leaves out — a transition history and replay protection.

Using an AI coding assistant? llms.txt is a compact API reference designed for LLMs. Projects using the llm/skills Composer plugin also get this package's agent skill synced into .agents/skills/ automatically on install.

Русская версия

What it does

Requirements

Installation

yiisoft/config picks the package up automatically. Nothing else is bound by default — see Audit trail for the one binding you may want to add.

Configuration

Places and transition endpoints accept backed enums or plain strings. In a state machine a transition with several sources is expanded into one transition per source — the same normalisation Symfony's YAML config performs.

Metadata is declarative too — it lands in the definition's metadata store, readable by guards (getMetadataStore()) and rendered by the dumpers:

A placesMetadata key that names an unknown place is an error, not silently dead configuration.

Usage

Method Returns Notes
applyOnce($subject, $transition, $key = null, $context = []) bool false = replay skipped
apply($subject, $transition, $context = []) Marking No idempotency check
can($subject, $transition) bool Guards are evaluated
blockers($subject, $transition) TransitionBlockerList Why it is unavailable
enabledTransitions($subject) iterable<Transition> Currently possible transitions
name() / definition() / workflow() Name, graph, the wrapped WorkflowInterface

A key is scoped to (workflow, subject), not to a transition: reusing a key on the same subject with a different transition is reported as a replay (false), so keys must be unique per operation. applyOnce() refuses a key its wiring cannot honour — no TransitionLog, no IdempotencyContext, or an AuditListener that never recorded the key — with a LogicException instead of silently applying without protection.

With a persistent log the audit row is written inside apply(): run applyOnce() and your save() in one database transaction. Otherwise a failed save burns the key — the log says the transition happened, the entity never changed, and every retry is skipped as a replay. See the yii3-workflow-db README for the recipe — that package also ships a WorkflowTransaction helper that makes it a single call.

Every skipped replay is also dispatched to the application's PSR-14 dispatcher as an Audit\TransitionReplayed event (workflow, subject id, transition, key, and whether the pre-flight lookup or the storage constraint decided), so replays can be counted and logged instead of disappearing into a false.

Guards and reactions

Every workflow event reaches the application's PSR-14 dispatcher exactly once — under the generic name, not once per workflow.<name>.<event> variant — so a class-based listener is not called three times. Guard listeners therefore run for every workflow of the application; extend TransitionGuard and the "is this my workflow, is this my transition" filtering is done for you:

A plain PSR-14 listener on the event class still works — the base class only removes the filtering ritual.

Register it like any other Yii3 listener (config/common/events-web.php). The blocker's message and code come back through blockers(), so an API can tell the user why an action is unavailable.

Audit trail

TransitionLog is deliberately not bound by this package — exactly like yiisoft/cache leaves Psr\SimpleCache\CacheInterface to a backend. Without a binding the workflows still run and record nothing; passing an idempotency key in that state is refused with a LogicException rather than silently doing nothing.

Install rasuvaeff/yii3-workflow-db for a yiisoft/db implementation with the migration, or bind your own:

An implementation stores TransitionRecord::toArray() rows and answers hasIdempotencyKey(). InMemoryTransitionLog ships for tests and one-off scripts.

Dumping a diagram

WorkflowDumpCommand is registered as workflow:dump through params.php:

The diagram flavour follows the configured type: a state_machine is drawn with direct edges between places, a Petri-net workflow with explicit transition nodes.

Security

The package performs no I/O of its own: it moves a marking on an object you pass in and hands audit rows to your TransitionLog. Transition and place names come from your configuration, never from user input — keep it that way, since a name reaching apply() selects behaviour. Guard listeners are the place for authorisation checks; a transition without a guard is allowed for anyone who can reach the handler.

Examples

See examples/ for a runnable script covering the whole loop.

Development

No PHP or Composer on the host — every target runs inside the composer:2 Docker image.

License

BSD-3-Clause. See LICENSE.md.


All versions of yii3-workflow with dependencies

PHP Build Version
Package Version
Requires php Version 8.3 - 8.5
psr/clock Version ^1.0
psr/event-dispatcher Version ^1.0
symfony/console Version ^6.4 || ^7.0 || ^8.0
symfony/event-dispatcher-contracts Version ^3.0
symfony/workflow Version ^6.4 || ^7.0 || ^8.0
yiisoft/definitions Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rasuvaeff/yii3-workflow contains the following files

Loading the files please wait ...