bravo3 / spa-bundle
Symfony 2 的包,用于创建单页应用(SPA)网络应用
0.1.1
2015-05-09 05:59 UTC
Requires
- php: >=5.5.0
This package is not auto-updated.
Last update: 2024-09-28 17:06:30 UTC
README
此包使您可以将任何普通的 Symfony 2 应用程序转换为“SPA”应用程序,使第一页加载正常渲染,所有后续页面请求通过 XHR 加载。
页面内容被拆分为“块”,只有主站点布局所需的部分会被重新渲染。
此包要求您的应用程序使用 Twig 渲染,只需要对控制器进行少量修改。
class HomeController extends AbstractSpaController
{
/**
* @Route("/", name="home")
* @param Request $request
* @return Response
*/
public function homeAction(Request $request)
{
// ..
// Call the AbstractSpaController#render() function to trigger the SPA engine -
return $this->render('@MySiteBundle/Home/home.html.twig', ['param' => 'value']);
}
}