share(function () use ($app) { return $app['cache.path'].'/serializer/'; }); $app['serializer.src_directory'] = $app['root.path'] . '/vendor/jms/serializer/src/'; $app['serializer.metadata.annotation_reader'] = $app->share(function () use ($app) { AnnotationRegistry::registerAutoloadNamespace("JMS\Serializer\Annotation", $app['serializer.src_directory']); return new AnnotationReader(); }); $app['serializer'] = $app->share(function (Application $app) { return SerializerBuilder::create()->setCacheDir($app['serializer.cache-directory']) ->setDebug($app['debug']) ->setAnnotationReader($app['serializer.metadata.annotation_reader']) ->build(); }); } public function boot(Application $app) { } }