当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::post方法代码示例

本文整理汇总了PHP中Silex\Application::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::post方法的具体用法?PHP Application::post怎么用?PHP Application::post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Silex\Application的用法示例。


在下文中一共展示了Application::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createResource

 /**
  * Create a resource and all its sub-resources.
  *
  * @param array $resourceConfig
  * @param array $parentUris
  * @throws \RuntimeException
  */
 public function createResource(array $resourceConfig, array $parentUris = array())
 {
     if (empty($resourceConfig['uri']) || empty($resourceConfig['ctl'])) {
         throw new \RuntimeException('Invalid resource config encountered. Config must contain uri and ctl keys');
     }
     if ($resourceConfig['ctl'] instanceof \Closure) {
         //registers controller factory inline
         $controllerName = $this->registerController($resourceConfig['uri'], $resourceConfig['ctl'], $parentUris);
     } elseif (is_string($resourceConfig['ctl'])) {
         $controllerName = $resourceConfig['ctl'];
     } else {
         throw new \RuntimeException('Ctl must be a factory (Closure) or existing service (string name)');
     }
     //setup routes
     $this->app->get($this->createRouteUri($resourceConfig['uri'], $parentUris, true), sprintf('%s:get', $controllerName));
     $this->app->get($this->createRouteUri($resourceConfig['uri'], $parentUris, false), sprintf('%s:cget', $controllerName));
     $this->app->post($this->createRouteUri($resourceConfig['uri'], $parentUris, false), sprintf('%s:post', $controllerName));
     $this->app->put($this->createRouteUri($resourceConfig['uri'], $parentUris, true), sprintf('%s:put', $controllerName));
     $this->app->patch($this->createRouteUri($resourceConfig['uri'], $parentUris, true), sprintf('%s:patch', $controllerName));
     $this->app->delete($this->createRouteUri($resourceConfig['uri'], $parentUris, true), sprintf('%s:delete', $controllerName));
     //handle sub resources
     if (!empty($resourceConfig['sub'])) {
         if (!is_array($resourceConfig['sub'])) {
             throw new \RuntimeException('sub config must contain array of sub resources');
         }
         //append current uri as parent
         $parentUris[] = $resourceConfig['uri'];
         foreach ($resourceConfig['sub'] as $subResource) {
             $this->createResource($subResource, $parentUris);
         }
     }
 }
开发者ID:warmans,项目名称:silex-rest-provider,代码行数:39,代码来源:RestService.php

示例2: register

 /**
  * register.
  *
  * @param Application $app
  */
 public function register(BaseApplication $app)
 {
     $app->post('/related_product/search_product', '\\Plugin\\RelatedProduct\\Controller\\Admin\\RelatedProductController::searchProduct')->bind('admin_related_product_search');
     $app->post('/related_product/get_product', '\\Plugin\\RelatedProduct\\Controller\\Admin\\RelatedProductController::getProduct')->bind('admin_related_product_get_product');
     $app->match('/' . $app['config']['admin_route'] . '/related_product/search/product/page/{page_no}', '\\Plugin\\RelatedProduct\\Controller\\Admin\\RelatedProductController::searchProduct')->assert('page_no', '\\d+')->bind('admin_related_product_search_product_page');
     // イベントの追加
     $app['eccube.plugin.relatedproduct.event'] = $app->share(function () use($app) {
         return new Event($app);
     });
     $app['eccube.plugin.relatedproduct.event.legacy'] = $app->share(function () use($app) {
         return new EventLegacy($app);
     });
     // Formの定義
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new RelatedProductType($app);
         return $types;
     }));
     // @deprecated for since v3.0.0, to be removed in 3.1.
     if (!Version::isSupportGetInstanceFunction()) {
         // Form/Extension
         $app['form.type.extensions'] = $app->share($app->extend('form.type.extensions', function ($extensions) {
             $extensions[] = new RelatedCollectionExtension();
             return $extensions;
         }));
     }
     // Repository
     $app['eccube.plugin.repository.related_product'] = function () use($app) {
         return $app['orm.em']->getRepository('\\Plugin\\RelatedProduct\\Entity\\RelatedProduct');
     };
     // メッセージ登録
     $app['translator'] = $app->share($app->extend('translator', function (Translator $translator, Application $app) {
         $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
         if (file_exists($file)) {
             $translator->addResource('yaml', $file, $app['locale']);
         }
         return $translator;
     }));
     // Add config file.
     $app['config'] = $app->share($app->extend('config', function ($config) {
         // Update constants
         $constantFile = __DIR__ . '/../Resource/config/constant.yml';
         if (file_exists($constantFile)) {
             $constant = Yaml::parse(file_get_contents($constantFile));
             if (!empty($constant)) {
                 // Replace constants
                 $config = array_replace_recursive($config, $constant);
             }
         }
         return $config;
     }));
     // initialize logger (for 3.0.0 - 3.0.8)
     if (!Version::isSupportGetInstanceFunction()) {
         eccube_log_init($app);
     }
 }
开发者ID:EC-CUBE,项目名称:related-product-plugin,代码行数:60,代码来源:RelatedProductServiceProvider.php

示例3: register

 /**
  * {@inheritDoc}
  */
 public function register(SilexApplication $app)
 {
     $app['payum.api.controller.root'] = $app->share(function () {
         return new RootController();
     });
     $app['payum.api.controller.payment'] = $app->share(function () use($app) {
         return new PaymentController($app['payum.security.token_factory'], $app['payum.security.http_request_verifier'], $app['payum'], $app['api.view.order_to_json_converter'], $app['form.factory'], $app['api.view.form_to_json_converter']);
     });
     $app['payum.api.controller.gateway'] = $app->share(function () use($app) {
         return new GatewayController($app['form.factory'], $app['url_generator'], $app['api.view.form_to_json_converter'], $app['payum.gateway_config_storage'], $app['api.view.gateway_config_to_json_converter']);
     });
     $app['payum.api.controller.gateway_meta'] = $app->share(function () use($app) {
         return new GatewayMetaController($app['form.factory'], $app['api.view.form_to_json_converter'], $app['payum']);
     });
     $app->get('/', 'payum.api.controller.root:rootAction')->bind('api_root');
     $app->get('/payments/meta', 'payum.api.controller.payment:metaAction')->bind('payment_meta');
     $app->get('/payments/{payum_token}', 'payum.api.controller.payment:getAction')->bind('payment_get');
     $app->put('/payments/{payum_token}', 'payum.api.controller.payment:updateAction')->bind('payment_update');
     $app->delete('/payments/{payum_token}', 'payum.api.controller.payment:deleteAction')->bind('payment_delete');
     $app->post('/payments', 'payum.api.controller.payment:createAction')->bind('payment_create');
     $app->get('/payments', 'payum.api.controller.payment:allAction')->bind('payment_all');
     $app->get('/gateways/meta', 'payum.api.controller.gateway_meta:getAllAction')->bind('payment_factory_get_all');
     $app->get('/gateways', 'payum.api.controller.gateway:allAction')->bind('gateway_all');
     $app->get('/gateways/{name}', 'payum.api.controller.gateway:getAction')->bind('gateway_get');
     $app->delete('/gateways/{name}', 'payum.api.controller.gateway:deleteAction')->bind('gateway_delete');
     $app->post('/gateways', 'payum.api.controller.gateway:createAction')->bind('gateway_create');
     $app->before(function (Request $request, Application $app) {
         if (in_array($request->getMethod(), array('GET', 'OPTIONS', 'DELETE'))) {
             return;
         }
         if ('json' !== $request->getContentType()) {
             throw new BadRequestHttpException('The request content type is invalid. It must be application/json');
         }
         $decodedContent = json_decode($request->getContent(), true);
         if (null === $decodedContent) {
             throw new BadRequestHttpException('The request content is not valid json.');
         }
         $request->attributes->set('content', $decodedContent);
     });
     $app->after(function (Request $request, Response $response) use($app) {
         if ($response instanceof JsonResponse && $app['debug']) {
             $response->setEncodingOptions($response->getEncodingOptions() | JSON_PRETTY_PRINT);
         }
     });
     $app->after($app["cors"]);
     $app->error(function (\Exception $e, $code) use($app) {
         if ('json' !== $app['request']->getContentType()) {
             return;
         }
         return new JsonResponse(array('exception' => get_class($e), 'message' => $e->getMessage(), 'code' => $e->getCode(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'stackTrace' => $e->getTraceAsString()));
     }, $priority = -100);
 }
开发者ID:Headd2k,项目名称:PayumServer,代码行数:55,代码来源:ApiControllerProvider.php

示例4: loadSave

 private function loadSave()
 {
     $this->application->post('/api/' . $this->version . '/address-books.json', function (Application $application) {
         $controller = new AddressBook($application);
         return $controller->save($application['request']);
     });
     $this->application->post('/api/' . $this->version . '/address-books/{id}.json', function (Application $application, $id) {
         $controller = new AddressBook($application);
         return $controller->save($application['request'], $id);
     })->convert('id', function ($id) {
         return (int) $id;
     })->assert('id', '\\d+');
 }
开发者ID:bflechel,项目名称:OpenAddressBook,代码行数:13,代码来源:Dispatcher.php

示例5: notReplaceIfBodyContentIsNotJson

 /**
  * @test
  */
 public function notReplaceIfBodyContentIsNotJson()
 {
     $self = $this;
     $body = array("number" => 123, "string" => "foo", "array" => array(5, 27, 42), "object" => (object) array("bar" => "baz"), "true" => true, "false" => false);
     $this->app->register(new JsonBodyProvider());
     $this->app->post("/", function (Request $req) use($self) {
         $self->assertCount(0, $req->request);
         return "Done.";
     });
     $client = new Client($this->app);
     $client->request('POST', '/', array(), array(), array('CONTENT_TYPE' => 'application/json'), json_encode($body) . "..broken!!!");
     $response = $client->getResponse();
     $this->assertEquals("Done.", $response->getContent());
 }
开发者ID:kumatch,项目名称:silex-json-body-provider,代码行数:17,代码来源:JsonBodyProviderTest.php

示例6: setup

 public function setup()
 {
     // Taken from the README.md: START
     $app = new \Silex\Application();
     $app->register(new \AIV\Integration\SilexProvider(), ['aiv.namespaced' => true, 'aiv.validators' => ['test-name' => ['options' => ['allow.extra.params' => true, 'allow.missing.params' => true], 'params' => ['name' => ['not.blank', ['type' => 'length', 'options' => ['min' => 2, 'max' => 20]]], 'email' => ['not.blank', '%email.validator%'], 'password' => ['not.blank']]]]]);
     $app['email.validator'] = $app->share(function () {
         return new \Symfony\Component\Validator\Constraints\Email();
     });
     $app->post('/', function (Application $app) {
         $apiValidator = $app['validator'];
         $validator = $apiValidator->getValidator('test-name');
         if ($validator->hasErrors()) {
             $errors = [];
             foreach ($validator->getErrors() as $violation) {
                 $path = preg_replace('/[\\[\\]]/', '', $violation->getPropertyPath());
                 $errors[$path] = $violation->getMessage();
             }
             return sprintf('You have errors: <pre>%s</pre>', print_r($errors, true));
         } else {
             return sprintf('You sent me valid data:<br /><pre>%s</pre>', print_r($validator->getData(), true));
         }
     });
     // Taken from the README.md: END
     $this->app = $app;
 }
开发者ID:renegare,项目名称:aiv,代码行数:25,代码来源:SilexProviderNamespacedTest.php

示例7: register

 public function register(BaseApplication $app)
 {
     // リポジトリ
     $app['eccube.plugin.product_rank.repository.product_rank'] = $app->share(function () use($app) {
         return new ProductRankRepository($app['orm.em'], $app['orm.em']->getClassMetadata('\\Eccube\\Entity\\ProductCategory'), $app);
     });
     $basePath = '/' . $app["config"]["admin_route"];
     // 一覧
     $app->match($basePath . '/product/product_rank/', '\\Plugin\\ProductRank\\Controller\\ProductRankController::index')->bind('admin_product_product_rank');
     // 一覧:上
     $app->put($basePath . '/product/product_rank/{category_id}/{product_id}/up', '\\Plugin\\ProductRank\\Controller\\ProductRankController::up')->assert('category_id', '\\d+')->assert('product_id', '\\d+')->bind('admin_product_product_rank_up');
     // 一覧:下
     $app->put($basePath . '/product/product_rank/{category_id}/{product_id}/down', '\\Plugin\\ProductRank\\Controller\\ProductRankController::down')->assert('category_id', '\\d+')->assert('product_id', '\\d+')->bind('admin_product_product_rank_down');
     // 一覧:N番目へ移動
     $app->post($basePath . '/product/product_rank/moveRank', '\\Plugin\\ProductRank\\Controller\\ProductRankController::moveRank')->assert('category_id', '\\d+')->assert('product_id', '\\d+')->assert('position', '\\d+')->bind('admin_product_product_rank_move_rank');
     // カテゴリ選択
     $app->match($basePath . '/product/product_rank/{category_id}', '\\Plugin\\ProductRank\\Controller\\ProductRankController::index')->assert('category_id', '\\d+')->bind('admin_product_product_rank_show');
     // メッセージ登録
     $app['translator'] = $app->share($app->extend('translator', function ($translator, \Silex\Application $app) {
         $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader());
         $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
         if (file_exists($file)) {
             $translator->addResource('yaml', $file, $app['locale']);
         }
         return $translator;
     }));
     // メニュー登録
     $app['config'] = $app->share($app->extend('config', function ($config) {
         $addNavi['id'] = "product_rank";
         $addNavi['name'] = "商品並び替え";
         $addNavi['url'] = "admin_product_product_rank";
         self::addNavi($config['nav'], $addNavi, array('product'));
         return $config;
     }));
 }
开发者ID:lockontatsuyaito,项目名称:ProductRank-plugin,代码行数:35,代码来源:ProductRankServiceProvider.php

示例8: getSilexApplication

 private function getSilexApplication()
 {
     $app = new Application();
     $app->register(new AngularPostRequestServiceProvider());
     $app->post("/post", function (Application $app, Request $request) {
         return $app->json(['status' => true, 'name' => $request->get('name')]);
     });
     return $app;
 }
开发者ID:gonzalo123,项目名称:angularpostrequestserviceprovider,代码行数:9,代码来源:SilexApplicationExampleTest.php

示例9: register

 public function register(BaseApplication $app)
 {
     // おすすめ情報テーブルリポジトリ
     $app['eccube.plugin.recommend.repository.recommend_product'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\Recommend\\Entity\\RecommendProduct');
     });
     // おすすめ商品の一覧
     $app->match('/' . $app["config"]["admin_route"] . '/recommend', '\\Plugin\\Recommend\\Controller\\RecommendController::index')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_list');
     // おすすめ商品の新規先
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/new', '\\Plugin\\Recommend\\Controller\\RecommendController::create')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_new');
     // おすすめ商品の新規作成・編集確定
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/commit', '\\Plugin\\Recommend\\Controller\\RecommendController::commit')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_commit');
     // おすすめ商品の編集
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/edit/{id}', '\\Plugin\\Recommend\\Controller\\RecommendController::edit')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_edit');
     // おすすめ商品の削除
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/delete/{id}', '\\Plugin\\Recommend\\Controller\\RecommendController::delete')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_delete');
     // おすすめ商品のランク移動(上)
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/rank_up/{id}', '\\Plugin\\Recommend\\Controller\\RecommendController::rankUp')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_rank_up');
     // おすすめ商品のランク移動(下)
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/rank_down/{id}', '\\Plugin\\Recommend\\Controller\\RecommendController::rankDown')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_rank_down');
     // 商品検索画面表示
     $app->post('/' . $app["config"]["admin_route"] . '/recommend/search/product', '\\Plugin\\Recommend\\Controller\\RecommendSearchModelController::searchProduct')->bind('admin_recommend_search_product');
     // ブロック
     $app->match('/block/recommend_product_block', '\\Plugin\\Recommend\\Controller\\Block\\RecommendController::index')->bind('block_recommend_product_block');
     // 型登録
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new \Plugin\Recommend\Form\Type\RecommendProductType($app);
         return $types;
     }));
     // サービスの登録
     $app['eccube.plugin.recommend.service.recommend'] = $app->share(function () use($app) {
         return new \Plugin\Recommend\Service\RecommendService($app);
     });
     // メッセージ登録
     $app['translator'] = $app->share($app->extend('translator', function ($translator, \Silex\Application $app) {
         $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader());
         $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
         if (file_exists($file)) {
             $translator->addResource('yaml', $file, $app['locale']);
         }
         return $translator;
     }));
     // メニュー登録
     $app['config'] = $app->share($app->extend('config', function ($config) {
         $addNavi['id'] = 'admin_recommend';
         $addNavi['name'] = 'おすすめ管理';
         $addNavi['url'] = 'admin_recommend_list';
         $nav = $config['nav'];
         foreach ($nav as $key => $val) {
             if ('content' == $val['id']) {
                 $nav[$key]['child'][] = $addNavi;
             }
         }
         $config['nav'] = $nav;
         return $config;
     }));
 }
开发者ID:k-yamamura,项目名称:Recommend-plugin,代码行数:57,代码来源:RecommendServiceProvider.php

示例10: connect

 public function connect(Application $app)
 {
     // creates a new controller based on the default route
     $front = $app['controllers_factory'];
     $front->get("/", 'FrontController\\Homepage::index')->bind("homepage");
     $front->match("/final_test", 'FrontController\\FinalTest::index')->bind("final_test");
     $front->match("/control_test", 'FrontController\\ControlTest::index')->bind("control_test");
     $front->match("/{course_type}", 'FrontController\\CourseType::index')->bind("course_type");
     //$front->post("/{course_type}", 'FrontController\Score::index')->bind("course_type");
     $app->get('/logout', function (Request $request) use($app) {
         $app['session']->set('username', '');
         $app['session']->set('id', '');
         $redirect = $app["url_generator"]->generate("homepage");
         return $app->redirect($redirect);
     })->bind("logout");
     $app->post('/login-check', function (Request $request) use($app) {
         $em = $app['orm.em'];
         $qb = $em->createQueryBuilder();
         if (null !== $request->get('username2')) {
             $username = $request->get('username2');
             $query = $qb->select('u')->from('models\\User', 'u')->where("u.username = '" . $username . "'")->getQuery();
             $result = $query->getResult();
             $result_count = count($result);
             if ($result_count > 0) {
                 return 'Helaas, de gebruikersnaam die je hebt ingevoerd bestaat al, probeer eens een andere.';
             } else {
                 $user = new User();
                 $user->setUsername($username);
                 $user->setRoles("ROLE_USER");
                 $em->persist($user);
                 $em->flush();
                 $id = $user->getId();
                 $app['session']->set('id', $id);
                 $app['session']->set('username', $username);
                 return 'succes';
             }
         } else {
             if ($request->get('username') != '') {
                 $username = $request->get('username');
                 $query = $qb->select('u')->from('models\\User', 'u')->where("u.username = '" . $username . "'")->getQuery();
                 $result = $query->getResult();
                 $result_count = count($result);
                 if ($result_count < 1) {
                     return 'De gebruikersnaam die je hebt ingevoerd bestaat niet, probeer het eens opnieuw.';
                 } else {
                     $id = $result[0]->id;
                     $app['session']->set('id', $id);
                     $app['session']->set('username', $username);
                     return 'succes';
                 }
             }
         }
     })->bind("login_check");
     return $front;
 }
开发者ID:janvaneck,项目名称:school,代码行数:55,代码来源:FrontProvider.php

示例11: register

 public function register(Application $app)
 {
     $app['webmentions_root'] = getenv("ROOT_DIR") . "/webmentions";
     $app['action.receive_webmention'] = $app->share(function () use($app) {
         $adapter = new Local($app['webmentions_root']);
         $filesystem = new Filesystem($adapter);
         $eventWriter = new EventWriter($filesystem);
         return new ReceiveWebmentionAction(new ReceiveWebmentionResponder($app['response'], $app['twig'], new RenderPost($app['twig'])), new ReceiveWebmentionHandler(new VerifyWebmentionRequest(), $eventWriter));
     });
     $app->post('/webmention', 'action.receive_webmention:__invoke');
 }
开发者ID:j4y-funabashi,项目名称:aruna,代码行数:11,代码来源:WebmentionServiceProvider.php

示例12: register

 /**
  * @inheritdoc
  */
 public function register(Application $app)
 {
     $app->get('/', 'DashboardController:index')->bind('dashboard');
     $app->post('/api', 'ApiController:save');
     $app->get('/applications', 'ApplicationsController:index')->bind('applications');
     $app->post('/applications/add', 'ApplicationsController:index')->bind('applications_add');
     $app->get('/login', 'LoginController:index')->bind('login');
     $app->get('/reports', 'ReportsController:index')->bind('reports');
     $app->get('/reports/{id}', 'ReportsController:view')->bind('reports_view');
     $app->get('/search/{query}', 'SearchController:query')->bind('search');
     $app->get('/settings', 'SettingsController:index')->bind('settings');
     $app->post('/settings/update', 'SettingsController:index')->bind('settings_update');
     /** var $datatables \Silex\ControllerCollection */
     $datatables = $app['controllers_factory'];
     $datatables->post('/applications', 'DatatablesController:applications')->bind('datatables_applications');
     $datatables->post('/reports', 'DatatablesController:reports')->bind('datatables_reports');
     $app->mount('/datatables', $datatables);
     /** var $delete \Silex\ControllerCollection */
     $delete = $app['controllers_factory'];
     $delete->post('/applications', 'DeleteController:applications')->bind('delete_applications');
     $delete->post('/reports', 'DeleteController:reports')->bind('delete_reports');
     $app->mount('/delete', $delete);
 }
开发者ID:vaibhavpandeyvpz,项目名称:acraviz,代码行数:26,代码来源:RoutesServiceProvider.php

示例13: createApplication

 /**
  * @return \Silex\Application
  */
 public function createApplication()
 {
     $app = new Application();
     $app['debug'] = true;
     $callback = function () use($app) {
         $subRequestHandler = new SubRequestHandler($app);
         return $subRequestHandler->handleSubRequest(new Request(), self::URL_SUB_REQUEST);
     };
     $app->get(self::URL_MASTER_REQUEST, $callback);
     $app->post(self::URL_MASTER_REQUEST, $callback);
     $app->get(self::URL_SUB_REQUEST, function () use($app) {
         return new RedirectResponse(self::URL_SUB_REQUEST);
     });
     return $app;
 }
开发者ID:spryker,项目名称:Application,代码行数:18,代码来源:SubRequestHandlerTest.php

示例14: boot

 /**
  * Setup the application.
  * 
  * @param Application $app 
  */
 public function boot(Application $app)
 {
     // the direct api route
     $app->get('/api.js', function (Application $app) {
         return $app['direct.api']->getApi();
     })->bind('directapi');
     // the direct api route remoting description
     $app->get('/remoting.js', function (Application $app) {
         return $app['direct.api']->getRemoting();
     });
     // the direct router route
     $app->post('/route', function (Application $app) {
         // handle the route
         return $app['direct.router']->route();
     });
 }
开发者ID:oaugustus,项目名称:direct-silex-provider,代码行数:21,代码来源:DirectServiceProvider.php

示例15: register

 public function register(Application $app)
 {
     $app['action.create_post'] = $app->share(function () use($app) {
         return new CreatePostAction($app["create_post.handler"], new CreatePostResponder($app['response'], $app['twig'], new RenderPost($app['twig'])));
     });
     $app['access_token'] = $app->share(function () use($app) {
         return new VerifyAccessToken($app['http_client'], $app['token_endpoint'], $app['me_endpoint']);
     });
     $app['create_post.handler'] = $app->share(function () use($app) {
         return new CreatePostHandler($app['posts_repository_writer'], $app['access_token']);
     });
     $app['posts_repository_writer'] = $app->share(function () use($app) {
         $adapter = new \League\Flysystem\Adapter\Local($app['posts_root']);
         $filesystem = new \League\Flysystem\Filesystem($adapter);
         return new PostRepositoryWriter($filesystem, $app['db_cache']);
     });
     $app->post('/micropub', 'action.create_post:__invoke');
 }
开发者ID:j4y-funabashi,项目名称:aruna,代码行数:18,代码来源:MicropubServiceProvider.php


注:本文中的Silex\Application::post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。