ajgl/breakpoint-twig-extension
用于设置断点的Twig扩展
0.4.2
2024-01-22 17:48 UTC
Requires
- php: >=7.4
- twig/twig: ^2.15.3 || ^3.0 || ^4.0
Requires (Dev)
- composer/xdebug-handler: ^2.0 || ^3.0
- friendsofphp/php-cs-fixer: ^3.13
- phpunit/phpunit: ^9.5.6
- symfony/framework-bundle: ^4.4 || ^5.4 || ^6.3 || ^7.0
- symfony/phpunit-bridge: >=7.0
- symfony/twig-bundle: ^4.4 || ^5.4 || ^6.3 || ^7.0
Suggests
- ext-xdebug: The Xdebug extension is required for the breakpoint to work
- composer/xdebug-handler: To improve de Xdebug detection
- symfony/framework-bundle: The framework bundle to integrate the extension into Symfony
- symfony/twig-bundle: The twig bundle to integrate the extension into Symfony
Conflicts
- composer/xdebug-handler: <2.0
- symfony/framework-bundle: <4.4
- symfony/twig-bundle: <4.4
README
AjglBreakpointTwigExtension组件允许你在twig模板中设置断点。
此组件需要安装Xdebug PHP扩展。
安装
要安装此组件的最新稳定版本,请打开控制台并执行以下命令
composer require ajgl/breakpoint-twig-extension --dev
用法
第一步是将扩展注册到twig环境中
/* @var $twig Twig_Environment */ $twig->addExtension(new Ajgl\Twig\Extension\BreakpointExtension());
注册后,你可以调用新的breakpoint
函数
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>title</title> </head> <body> {{ breakpoint() }} </body> </html>
一旦停止,你的调试器将允许你检查$environment
和$context
变量。
函数参数
传递给twig函数的任何参数都将添加到$arguments
数组中,因此你可以轻松检查它。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>title</title> </head> <body> {{ breakpoint(app.user, app.session) }} </body> </html>
Symfony Bundle
该包包含一个用于自动注册Twig扩展的Symfony Bundle。
如果应用程序使用Symfony Flex并且允许执行配方,则Bundle将自动启用。
如果您需要手动配置,请将以下行添加到config/bundles.php
文件中
// config/bundles.php //... return [ //... Ajgl\Twig\Extension\SymfonyBundle\AjglBreakpointTwigExtensionBundle::class => ['dev' => true] ];
许可证
此组件受MIT许可证的约束。请参阅LICENSE文件中的完整许可证。
报告问题或功能请求
问题和功能请求在Github问题跟踪器中跟踪。
作者信息
由Antonio J. García Lagar用♥开发。
如果您觉得这个组件很有用,请在该GitHub存储库页面上添加★。