Download the PHP package ademakanaky/laravel-workflows without Composer

On this page you can find all versions of the php package ademakanaky/laravel-workflows. 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 laravel-workflows

Laravel Workflows

A versioned, extensible workflow and approval engine for Laravel applications.

Laravel Workflows attaches durable processes to any Eloquent model. It provides explicit states and transitions, immutable definition versions, optional task assignment, transition guards, actor authorization, idempotency, lifecycle events, and an append-only audit history without requiring a particular role or tenancy package.

Requirements

Installation

Laravel discovers the package service provider automatically, and package migrations are loaded automatically. Publish the configuration only when you need to customize behavior:

If the application must own and modify its migration, publish it and set load_migrations to false in the published configuration before running migrations. This prevents both copies from being executed:

Applications upgrading from a release where the original migration was already published with load_migrations disabled can publish only the additive administration migration:

Applications upgrading from 1.1 with package migrations disabled must also publish the additive 1.2 migration:

Define a workflow

Add definitions to config/workflows.php:

Validate and synchronize definitions:

Synchronization creates a new immutable version only when a definition changes. Existing instances remain pinned to the version on which they started.

Definitions may also be constructed in application code:

Attach workflows to a model

The trait exposes workflowInstances() and activeWorkflowInstances() relationships. It does not automatically start workflows when a model is created; explicit startup avoids hidden writes and lets the application supply the correct actor and context.

Start and transition

Instances also provide a convenience method:

All state changes execute inside database transactions and lock the workflow instance row. Supplying idempotency keys makes identical retried starts and transitions return the original result rather than applying the operation twice. Reusing a key with different input throws IdempotencyConflictException.

Subjects and actors may use integer, UUID, or ULID string keys, but they must be persisted Eloquent models.

Cancel a workflow

Cancellation is an audited, idempotent operation intended for trusted application services:

Cancellation closes every open task, records a cancel history entry, and dispatches WorkflowCancelled after commit. The calling application remains responsible for authorizing cancellation.

Guards

Guards enforce business conditions on a particular transition:

Register a safe alias in config/workflows.php:

Reference the alias on a transition:

For the common maker/checker rule, register the package's built-in guard and place it only on transitions that must not be performed by the workflow initiator:

Guards are resolved through Laravel's container and must implement TransitionGuard. Class names remain supported for code-managed definitions, while aliases give an administration interface a finite allow-list it can safely display.

Assignment and authorization

The package intentionally has no dependency on Spatie Permission or a particular User model. Implement AssignmentStrategy to choose an assignee whenever a workflow enters a non-final state:

Configure it:

That global strategy is the fallback. To let code or an administration interface choose a policy for a particular state, register aliases and reference one in the definition:

Guard and assignment-strategy references are verified when a definition is published, so an unavailable extension cannot become a runtime-only failure.

The default TaskTransitionAuthorizer allows unassigned tasks and restricts assigned tasks to their assignee. Replace it with any class implementing TransitionAuthorizer to integrate gates, roles, teams, tenants, or service actors:

Applications remain responsible for authorizing access to their HTTP controllers and for preventing untrusted callers from invoking workflow management operations.

Optional Spatie Permission integration

When the consuming application uses spatie/laravel-permission, the package includes adapters that preserve task-assignment rules while adding role candidates and permission checks. The Spatie package remains optional.

Use a Spatie Role model as a state candidate, or attach a permission requirement to transition metadata:

The actor must still be eligible for the current task. Permission metadata may be a string or a list of strings.

Actor models may use the ParticipatesInWorkflows trait to obtain startedWorkflowInstances(), assignedWorkflowTasks(), and workflowActions() relationships.

Trusted application services may manually assign or unassign the current task. The operation is idempotent and recorded in workflow history:

Apply approved or rejected requests

Transition action handlers let each workflow or request type apply its own business behavior without putting domain logic in controllers or in this package. Implement WorkflowActionHandler and register a safe alias:

Attach handlers to the appropriate transitions. Transactional handlers execute before the state is changed and roll back the complete transition when they fail. After-commit handlers execute only after the outer database transaction commits and are suitable for integrations and side effects.

Handlers and their aliases are validated when a definition is published, included in definition export, and protected by transition idempotency.

Final states can carry an application-defined outcome. Entering one dispatches WorkflowOutcomeReached after commit, allowing a single listener to route approved, rejected, cancelled, or custom outcomes across request types:

Task inbox and notifications

Add ParticipatesInWorkflows to the model that may receive workflow tasks:

An authenticated user's pending-work page can use the facade-backed inbox. It returns only open tasks assigned to that actor and eager loads the workflow state, definition, and subject:

The count is suitable for navigation and menu badges. The same API is injectable when a facade is not desired:

The actor trait also exposes pendingWorkflowTasks(). Task queries may be composed directly:

Render the permitted actions for each inbox item and submit the selected transition through the normal runtime API:

For proactive alerts, implement WorkflowTaskNotifier. Its methods run after the enclosing database transaction commits, so notifications are never sent for rolled-back work. The default implementation does nothing.

Register it in config/workflows.php:

The notifier can send Laravel database, mail, broadcast, Slack, or other notifications. Queue the application's notification when delivery should happen asynchronously. Applications may instead listen directly for WorkflowTaskOpened, WorkflowTaskAssigned, WorkflowTaskCompleted, and WorkflowTaskCancelled.

Assigned tasks and unassigned tasks for which the actor is a candidate appear in the personal inbox. Configure candidates, an AssignmentStrategy, or explicitly call Workflow::assign() when a state requires an actor to take action.

Administration API

WorkflowAdministration is the supported headless boundary for an administration interface. The package deliberately does not prescribe routes, controllers, frontend technology, or authorization policy. A consuming application can build a Blade, Livewire, Inertia, API, Filament, Nova, or custom interface over the same service without a second package. Controllers should use this service or the WorkflowAdmin facade instead of updating package tables directly. The host application remains responsible for authorizing administrative routes and actions.

Create and edit drafts

WorkflowDraft is a mutable, serializable authoring object for forms and API payloads. Draft persistence remains application-owned, while validation and publication stay inside the package:

$admin->draft($slug) starts from the active or latest published version when one exists. State and transition removal, candidates, assignment strategies, guards, handlers, outcomes, and metadata are all editable through the draft API. The application decides who may save a draft, review it, and publish it.

Configure step participants

Candidates are versioned with the workflow definition. One candidate is assigned automatically. Multiple candidates receive the unassigned task in their inbox and an eligible candidate may claim it.

For an existing database-managed definition, this convenience method exports the active version, changes the candidates, and publishes a new immutable version:

Code-managed definitions remain read-only to database administration tools. Change their configuration in code and run workflow:sync.

Candidates are polymorphic Eloquent models. A candidate may therefore be a user, team, role, or another application-owned principal. To make team and role tasks appear in each member's inbox, implement WorkflowParticipantResolver and configure it as participant_resolver. Its principals() method returns the user together with their teams or roles, while matches() determines whether an actor represents a configured principal.

Inspect and search processes

Administration queries support normal Eloquent pagination and task/process scopes:

Claim, release, reassign, and nudge

All responsibility changes and reminders are recorded in the immutable workflow history.

Nudging updates last_nudged_at and nudge_count, creates a nudge history record, dispatches WorkflowTaskNudged after commit, and invokes WorkflowTaskNotifier::nudged().

Activate and deactivate definitions

Publishing a new definition version activates it for new process instances. Existing processes remain pinned to their original version. An administrator may explicitly activate an older version or prevent new starts:

Deactivation does not interrupt already running instances.

Dashboard summaries

History and events

Every start and transition creates an immutable WorkflowTransitionLog containing the states, action, actor, data, and idempotency key.

The package dispatches:

Listeners for the two pre-mutation events may throw an exception to abort and roll back the operation. Post-commit events are suitable for notifications, webhooks, and queued automation.

Headless administration integration

The package contains the complete runtime and authoring seams required by a custom administration experience; a dedicated UI package is not required.

Definitions have an ownership source:

An administration package publishes a validated blueprint through the contract:

Drafts can be checked without writing anything by resolving DefinitionValidator and calling validate($blueprint). This is the same validator used by workflow:validate and DefinitionPublisher, so preview and publication cannot drift onto different rule sets.

WorkflowDefinitionExporter converts any published version back to the same canonical array schema used by WorkflowBlueprint::fromArray(). This supports visual editing, cloning, import/export, diffs, and draft publication without coupling the admin package to internal tables.

WorkflowExtensionRegistry exposes the registered guards, assignment strategies, and action handlers that an interface may safely offer as dropdown choices. State-level assignment policies, transition guards, and action handlers are part of the canonical import/export schema. WorkflowDraft provides the mutable editing layer, while only validated publication crosses into immutable runtime records.

Custom models

Every package model is replaceable in config/workflows.php. Custom models should extend the corresponding package model so its relationships and casts remain available.

Safety characteristics

Testing

The suite uses Orchestra Testbench. CI exercises supported Laravel/PHP combinations with SQLite, runs the feature suite against MySQL and PostgreSQL, audits current dependencies, and installs the package into a clean Laravel application for an end-to-end smoke test.

The supported public API and release guarantees are documented in docs/STABLE_API.md.

Roadmap

The stable core focuses on deterministic sequential workflows. Planned extensions include parallel approval tasks, quorum approvals, deadlines, escalations, and scheduled automation.

Contributing

See CONTRIBUTING.md.

Security

See SECURITY.md for responsible disclosure guidance.

License

Laravel Workflows is released under the MIT License.


All versions of laravel-workflows with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^9.52.20|^10.48.28|^11.0|^12.0|^13.0
illuminate/contracts Version ^9.52.20|^10.48.28|^11.0|^12.0|^13.0
illuminate/database Version ^9.52.20|^10.48.28|^11.0|^12.0|^13.0
illuminate/events Version ^9.52.20|^10.48.28|^11.0|^12.0|^13.0
illuminate/support Version ^9.52.20|^10.48.28|^11.0|^12.0|^13.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 ademakanaky/laravel-workflows contains the following files

Loading the files please wait ...