PHPackages                             wesnick/api-platform-workflow-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. wesnick/api-platform-workflow-extension

AbandonedArchivedSymfony-bundle[API Development](/categories/api)

wesnick/api-platform-workflow-extension
=======================================

Opinionated integration of api platform with workflow component

111.1k4[3 issues](https://github.com/wesnick/api-platform-workflow-extension/issues)PHP

Since Jan 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/wesnick/api-platform-workflow-extension)[ Packagist](https://packagist.org/packages/wesnick/api-platform-workflow-extension)[ RSS](/packages/wesnick-api-platform-workflow-extension/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

WesnickWorkflowBundle
=====================

[](#wesnickworkflowbundle)

### This bundle is a work-in-progress.

[](#this-bundle-is-a-work-in-progress)

[![Build Status](https://camo.githubusercontent.com/bb268e89349bfdc13d0affe2a273d5018e3aadfb72f619025d2a01d0814c41c4/68747470733a2f2f7472617669732d63692e6f72672f7765736e69636b2f6170692d706c6174666f726d2d776f726b666c6f772d657874656e73696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/wesnick/api-platform-workflow-extension)[![Build Status](https://camo.githubusercontent.com/6c9b7abc6aa8e96a109ddb6df7cf70b4f579f842dafc5b6cb15a06ba8ec2d5d0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7765736e69636b2f6170692d706c6174666f726d2d776f726b666c6f772d657874656e73696f6e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/wesnick/api-platform-workflow-extension/build-status/master)

Introduction
------------

[](#introduction)

This bundle tries to allow relative easy integration between the API Platform and Symfony's Workflow component

The goal is:

- implement [actions as outlined in schema.org](https://schema.org/docs/actions.html)
- automatically expose workflow information as part of the resource payload.
- contains information about all available transitions
- contains available but blocked transitions with ConstraintViolation messages
- automatically expose endpoints to execute transitions.

    - workflows should try to do all mutations and persistence using listeners
- Workflows that support API Platform resources can be toggled to include workflow data and operations

    - Workflow transition information is added to the resource representation as an array of [potentialAction](https://schema.org/docs/actions.html)```
        {
          "id": 1,
          "name": "Bob",
          "potentialAction": [
            {
              "@type": "ControlAction",
              "target": {
                "@type": "Entrypoint",
                "httpMethod": "PATCH",
                "url": "/users/1?workflow=user_status&transition=ban_user"
              }
            }
          ]
        }
        ```
    - If any potential action has a workflow transition blocker, these are displayed as an Api Platform ConstraintViolation class type under the property error

    ```
    {
      "id": 1,
      "name": "Bob",
      "potentialAction": [
        {
          "@type": "ControlAction",
          "name": "ban",
          "description": "Ban a User",
          "target": {
            "@type": "Entrypoint",
            "httpMethod": "PATCH",
            "url": "/users/1?workflow=user_status&transition=ban_user"
          },
          "error": [{
            "message": "User must be enabled before banning.",
            "propertyPath": "/enabled"
          }]
        }
      ]
    }
    ```

    - The return type for workflows transition executions is always the subject. The subject will have updated potentialAction information as part of the response payload. If your transition succeeded 200, if it failed 400 with a ConstraintViolationList.
    - Depending on how you use workflows, you may or may not have data input for transitions. If there is no data, you can just PATCH a simple payload with the transition to the PATCH API endpoint. If your workflow transition requires data input, you can use the DTO feature to provide a custom input class

### Example

[](#example)

Here are some example payloads with a basic user promote demote workflow

GET a User

```
GET http://localhost/api/users/5
Content-Type: application/ld+json

{
  "@context": "\/api\/contexts\/User",
  "@id": "\/api\/users\/5",
  "@type": "User",
  "id": 5,
  "email": "erik.ledner@gmail.com",
  "lastLogin": null,
  "expired": false,
  "locked": false,
  "credentialsExpired": false,
  "enabled": true,
  "roles": [
    "ROLE_ADMIN"
  ],
  "potentialAction": [
    {
      "@context": "http:\/\/schema.org",
      "@type": "Action",
      "actionStatus": "PotentialActionStatus",
      "target": {
        "httpMethod": "PATCH",
        "url": "\/api\/users\/5?workflow=user_role&transition=promote_to_superadmin"
      },
      "name": "promote_to_superadmin",
      "description": "Promote to Super Admin"
    },
    {
      "@context": "http:\/\/schema.org",
      "@type": "Action",
      "actionStatus": "PotentialActionStatus",
      "target": {
        "httpMethod": "PATCH",
        "url": "\/api\/users\/5?workflow=user_role&transition=demote_to_user"
      },
      "name": "demote_to_user",
      "description": "Demote to User"
    }
  ]
}

```

Execute demote\_to\_user transition

```
PATCH http://localhost/api/users/5?workflow=user_role
Content-Type: application/ld+json

{
  "transition": "demote_to_user"
}

```

Response

```
{
  "@context": "\/api\/contexts\/User",
  "@id": "\/api\/users\/5",
  "@type": "User",
  "id": 5,
  "email": "erik.ledner@gmail.com",
  "lastLogin": null,
  "expired": false,
  "locked": false,
  "credentialsExpired": false,
  "enabled": true,
  "roles": [
    "ROLE_USER"
  ],
  "potentialAction": [
    {
      "@context": "http:\/\/schema.org",
      "@type": "Action",
      "actionStatus": "PotentialActionStatus",
      "target": {
        "httpMethod": "PATCH",
        "url": "\/api\/users\/5?workflow=user_role&transition=promote_to_admin"
      },
      "name": "promote_to_admin",
      "description": "Promote to Admin"
    },
    {
      "@context": "http:\/\/schema.org",
      "@type": "Action",
      "actionStatus": "PotentialActionStatus",
      "target": {
        "httpMethod": "PATCH",
        "url": "\/api\/users\/5?workflow=user_role&transition=promote_to_superadmin"
      },
      "name": "promote_to_superadmin",
      "description": "Promote to Super Admin"
    }
  ]
}
```

Features
--------

[](#features)

- Validation Helpers
- React admin integration (WIP)

Documentation
-------------

[](#documentation)

- enable the module

```
# config/packages/wesnick_workflow.yaml

wesnick_workflow:
    api_patch_transitions: true      # default
    workflow_validation_guard: true  # default
```

- To enable API support for your workflows:

    - Subject class must implement PotentialActionInterface
    - You can implement this interface either with PotentialActionsTrait or on your own, be sure to set serialization groups appropriately. The bundle automatically pushes the group `workflowAction:output` during denormalization.
- add descriptive messages for your workflow/transitions using workflow metadata

Roadmap
-------

[](#roadmap)

License
-------

[](#license)

This bundle is released under the MIT license. See the included [LICENSE](src/Resources/meta/LICENSE) file for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/519946?v=4)[Wesley Nichols](/maintainers/wesnick)[@wesnick](https://github.com/wesnick)

---

Top Contributors

[![wesnick](https://avatars.githubusercontent.com/u/519946?v=4)](https://github.com/wesnick "wesnick (23 commits)")

### Embed Badge

![Health badge](/badges/wesnick-api-platform-workflow-extension/health.svg)

```
[![Health](https://phpackages.com/badges/wesnick-api-platform-workflow-extension/health.svg)](https://phpackages.com/packages/wesnick-api-platform-workflow-extension)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
