izquierdogalan / benchmark-bundle
显示基准函数、API、控制器等
1.0.0
2015-06-13 15:57 UTC
Requires
- php: >=5.3.2
- devster/ubench: 1.2
- jms/aop-bundle: ^1.0
- symfony/framework-bundle: >=2.2.0,<3.0
This package is not auto-updated.
Last update: 2024-09-14 18:20:23 UTC
README
此Bundle为symfony 2提供@Benchmark注解,用于显示带有持续时间的日志,处理特定的函数或控制器。此Bundle需要JMSAopBundle。
安装和配置
获取Bundle
将其添加到您的 composer.json
文件
composer require izquierdogalan/benchmark-bundle
将BenchmarkBundle添加到您的应用程序内核
<?php // app/AppKernel.php public function registerBundles() { return array( // ... new JMS\AopBundle\JMSAopBundle(), new Easys\BenchmarkBundle\EasysBenchmarkBundle(), // ... ); }
在您的config.yml中添加
jms_aop:
cache_dir: %kernel.cache_dir%/jms_aop
使用示例
您必须在控制器或允许在方法中使用的基本函数中使用
<?php /** * @Route("/{page}", name="home", defaults={"page": 1}, requirements={"page": "\d+" }, methods = { "GET" }) * @Benchmark(description="Load index page.") */ public function indexAction($page) { return $this->render('EasysVideoPortalBundle:Orbit:Pages/index.html.twig'); }