Download the PHP package rasuvaeff/yii3-workflow-db without Composer

On this page you can find all versions of the php package rasuvaeff/yii3-workflow-db. 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-db

rasuvaeff/yii3-workflow-db

Stable Version Total Downloads Build Static analysis License

Database backend for rasuvaeff/yii3-workflow: stores the transition history on yiisoft/db and turns replay protection from a check into a constraint.

Using an AI coding assistant? llms.txt is a compact API reference designed for LLMs.

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

What it does

Requirements

Installation

yiisoft/config wires TransitionLog to DbTransitionLog automatically. Register the bundled migration (Rasuvaeff\Yii3WorkflowDb\Migration\M260722000000CreateWorkflowTransitionsTable) by namespace — no vendor paths:

yiisoft/db-migration resolves the migration through Injector::make(), so it picks up the table-name value object from the container the same way the log does — no manual wiring needed beyond setSourceNamespaces() above.

Do not configure the migration through the DI container. M...::class => ['__construct()' => ['table' => ...]] does not work: the migration is built by Injector::make(), which resolves arguments by type and never reads a container definition keyed by the migration's own class. Worse, adding that definition makes the container fatal at build time in every request, because the class is not autoloadable until the migration runner requires it. That recipe was documented in 1.x; it never worked.

Configuration

The same name reaches DbTransitionLog and the bundled migration, as a WorkflowTransitionsTableName. Index names follow it (idx_<table>_subject, idx_<table>_at, uq_<table>_idempotency), so two installations can share one PostgreSQL schema — index names are unique per schema there, not per table.

Schema

Column Type Note
id bigint PK insertion order = chronological order
workflow string(64) machine name
subject_id string(128) from SubjectIdentity::workflowSubjectId()
transition string(64) applied transition
from_place / to_place string(512) comma-joined for Petri-net transitions
at string(30) ATOM normalised to UTC, so ordering is lexicographic on every driver
idempotency_key string(128), nullable NULL repeats freely; a value is unique per subject

Indexes: (workflow, subject_id, id) for a subject's history, (at) for pruning and reports, and the unique (workflow, subject_id, idempotency_key).

Timestamps are converted to UTC before they are stored: with a varying UTC offset (a DST switch, app servers in different timezones) the string ordering that pruning relies on would break.

The migration adapts the unique index to the driver. MySQL, PostgreSQL and SQLite treat NULLs in a unique index as distinct, so a plain index already lets key-less rows repeat; MSSQL and Oracle compare them as equal, so there the index covers keyed rows only (a filtered index on MSSQL, a function-based one on Oracle). Tests run against SQLite — treat the MSSQL/Oracle paths as best-effort and verify them in your environment.

Usage

Nothing changes at the call site — the core API keeps working, only now it records and enforces:

Reading the history back, beyond the TransitionLog interface:

Transactions

A transition writes its audit row inside apply(), i.e. after the subject has already been mutated in memory. When the unique index rejects that write, applyOnce() returns false while the object in memory has moved on. Wrap the call and the entity save in one transaction — or discard the object — so a lost race cannot be persisted:

WorkflowTransaction makes the recipe a single call — the then closure runs inside the same transaction and only when the transition was actually applied:

A failed save rolls the audit row back with everything else, so the key is not burnt and a retry can succeed.

Pruning

Pruning also forgets idempotency keys: a request replayed with a key older than the retention window is applied again. Keep the window longer than the longest plausible replay (client retries, queue redeliveries).

Security

Rows are written from workflow events, never from user input, and the package runs only parameterised queries through yiisoft/db. The history is an audit source: give the application's DB user no DELETE on this table unless it runs the prune command, and remember that subject_id may identify a person — the retention policy is a privacy decision, not just a storage one.

Examples

See examples/ for a runnable script on in-memory SQLite.

Development

Unit and integration tests run against in-memory SQLite, so the database and migration paths need no server. make build runs the unit suite; run make test-integration for the SQLite integration suite. 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-db with dependencies

PHP Build Version
Package Version
Requires php Version 8.3 - 8.5
psr/clock Version ^1.0
rasuvaeff/yii3-workflow Version ^1.0
symfony/console Version ^6.4 || ^7.0 || ^8.0
yiisoft/db Version ^2.0
yiisoft/db-migration Version ^2.1
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-db contains the following files

Loading the files please wait ...