<?php require '../vendor/autoload.php'; \Exaprint\EventBus\EventBus::get()->executeSynchroneousDispatchesOnError();
<?php require '../vendor/autoload.php'; \Exaprint\EventBus\EventBus::get()->executeAsynchroneousDispatches();
use Exaprint\EventBus\EventBusException; use Exaprint\EventBus\Listener; use Exaprint\REST\Error; use Exaprint\REST\Renderer\RendererFactory; use Exaprint\REST\Resource; use Silex\Application; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; ini_set('display_errors', 1); error_reporting(E_ALL); require_once __DIR__ . '/../vendor/autoload.php'; $app = new Application(); $app['debug'] = true; $configFilename = isset($_SERVER['eventbus_config_filename']) ? $_SERVER['eventbus_config'] : __DIR__ . "/../config/dev.ini"; $options = parse_ini_file($configFilename, true); $bus = EventBus::get($options); $app->before(function (Request $request) { if (0 === strpos($request->headers->get('Content-Type'), 'application/json')) { $data = json_decode($request->getContent(), true); $request->request->replace(is_array($data) ? $data : []); } }); function createResponse(Application $app, Request $request, Resource $resource) { $contentType = $request->get('contentType', $request->headers->get('Accept')); $renderer = RendererFactory::getRenderer($contentType, $resource); return new Response($renderer->getContent(), $renderer->getStatus(), ['Content-Type' => $renderer->getContentType()]); } function createUnauthorizedResponse($app, $request) { $error = new Error();