krak / symfony-playground
Symfony playground 用于调试/测试您的应用程序。
v0.1.3
2020-06-04 01:45 UTC
Requires (Dev)
- nyholm/symfony-bundle-test: ^1.6
- phpunit/phpunit: ^9.1
- symfony/dependency-injection: ^4.4
- symfony/http-kernel: ^4.4
- symfony/var-dumper: ^5.1
This package is auto-updated.
Last update: 2024-09-13 16:59:27 UTC
README
Symfony playground 允许开发者在系统中快速测试任何代码,并访问应用程序中的任何私有服务。
安装
使用 composer 安装 krak/symfony-playground
。
然后,您需要将 config/bundles.php
文件中的 PlaygroundBundle 更改为仅开发模式
return [ // ... Krak\SymfonyPlayground\PlaygroundBundle::class => ['dev' => true], ];
使用方法
要启用 playground,您可以在项目根目录中创建一个 playground.php 文件: %kernel.project_dir%/playground.php
。
此文件需要返回一个闭包。以下是一个示例
<?php /** this function is autowired, so type hint any service to access it here */ return function(App\Service\MyService $service, Psr\Log\LoggerInterface $log) { $log->info("Playing with my symfony app!"); };
您可以使用: ./bin/console playground
运行此命令。