1. Go to this page and download the library: Download scopeli/ux-bpmn library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
scopeli / ux-bpmn example snippets
// ...
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);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.