scopeli / ux-bpmn
BPMN viewer and modeler for Symfony applications
Installs: 131
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.4.5
- ext-json: *
- symfony/config: ^4.4|^5.0|^6.0
- symfony/dependency-injection: ^4.4|^5.0|^6.0
- symfony/http-kernel: ^4.4|^5.0|^6.0
- symfony/twig-bundle: ^4.4|^5.0|^6.0
Requires (Dev)
- symfony/framework-bundle: ^4.4|^5.0|^6.0
- symfony/var-dumper: ^4.4|^5.0|^6.0
Conflicts
- symfony/flex: <1.13
This package is auto-updated.
Last update: 2025-01-06 20:26:35 UTC
README
UX BPMN is a Symfony bundle that integrating the bpmn.io library in Symfony applications. It provides a viewer and modeler.
You can checkout the demo for testing.
Installation
UX BPMN requires PHP 7.4.5+ and Symfony 4.4+.
Install this bundle using Composer and Symfony Flex:
composer require scopeli/ux-bpmn
# Don't forget to install the JavaScript dependencies as well and compile
yarn install --force
yarn encore dev
Usage
To use UX BPMN viewer and builder, create the following in PHP:
// ... use Scopeli\UxBpmn\Model\Modeler; use Scopeli\UxBpmn\Model\Viewer; class BpmnController extends AbstractController { const BPMN_FILE = 'example.bpmn'; /** * @Route("/show", name="bpmn_show", methods={"GET"}) */ public function show(): Response { return $this->render('bpmn/show.html.twig', [ 'viewer' => new Viewer(Viewer::TYPE_DEFAULT, file_get_contents(self::BPMN_FILE)), ]); } /** * @Route("/edit", name="bpmn_edit", methods={"GET"}) */ public function edit(): Response { $modeler = new Modeler(Modeler::TYPE_DEFAULT, file_get_contents(self::BPMN_FILE)); $modeler->setConfig([ 'saveUrl' => $this->generateUrl('bpmn_save'), ]); return $this->render('bpmn/edit.html.twig', [ 'modeler' => $modeler, ]); } /** * @Route("/save", name="bpmn_save", methods={"POST"}) */ public function save(Request $request): Response { $data = json_decode($request->getContent()); file_put_contents(self::BPMN_FILE, $data->xml); return new Response(null, Response::HTTP_NO_CONTENT); } }
After that, you can display the viewer and modeler in Twig (requires Symfony Webpack Encore):
{# bpmn/show.html.twig #} {{ render_bpmn_viewer(viewer) }}
{# bpmn/edit.html.twig #} {{ render_bpmn_modeler(modeler) }}