krak/symfony-playground

Symfony playground 用于调试/测试您的应用程序。

安装量: 11,684

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 1

公开问题: 1

类型:symfony-bundle

v0.1.3 2020-06-04 01:45 UTC

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 运行此命令。