Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Doc about debugbar in a programmatic_pipeline context #14

Open
weierophinney opened this issue Dec 31, 2019 · 2 comments
Open
Labels
Question Further information is requested

Comments

@weierophinney
Copy link
Contributor

Following the doc about debugbars, the php-middleware/php-debug-bar neither bitExpert/prophiler-psr7-middleware didn't work in a 'programmatic_pipelines' context.

What is the recommended way to pipe middleware only for development ?

For now I've ended up adding them in the config/pipeline.php file:

$app->pipe(ErrorHandler::class);

$debug = $app->getContainer()->get('config')['debug'] ?? false;
if ($debug) {
    /* example with phpdebugbar */
    $debugBarFactory = new \PhpMiddleware\PhpDebugBar\PhpDebugBarMiddlewareFactory();
    $middleware = $debugBarFactory();
    $app->pipe($middleware);

    /* example with prophilermiddleware */
    $prophiler  = new \Fabfuel\Prophiler\Profiler();
    $toolbar    = new \Fabfuel\Prophiler\Toolbar($prophiler);
    $middleware = new \bitExpert\Http\Middleware\Psr7\Prophiler\ProphilerMiddleware($toolbar);
    $app->pipe($middleware);
}

$app->pipe(ServerUrlMiddleware::class);
//...

Not sure if it's a good practive. BTW both debugbars looks pretty minimal. Is there any plan to have the ZendDeveloperTools toolbar for expressive ?

Note, for PHP7 and ProphilerMiddleware, you add:

$ composer require --dev fabfuel/prophiler:dev-feature/php7 bitexpert/prophiler-psr7-middleware

Originally posted by @belgattitude at zendframework/zend-expressive#488

@weierophinney weierophinney added the Question Further information is requested label Dec 31, 2019
@weierophinney
Copy link
Contributor Author

For me looks fine. One think what you can improve it's move building middlewares (with dependencies) to your container.


Originally posted by @snapshotpl at zendframework/zend-expressive#488 (comment)

@weierophinney
Copy link
Contributor Author

A good init.


Originally posted by @samuel20miglia at zendframework/zend-expressive#488 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant