Closed belgattitude closed 7 years ago
I could make it work with
$ composer require --dev fabfuel/prophiler:dev-feature/php7 bitexpert/prophiler-psr7-middleware
I might have missed in the doc ? But can be usefull to write it.
Thanks for pointing out. In the composer.json we require "fabfuel/prophiler": "^1.4|dev-feature/php7"
which I thought would fix the problem. Maybe we should release a new version and specifically target PHP 7.1. Will think about it.
Would be great ;)
Note that I couldn't make it work under zend-expressive 2.0 with 'programmatic pipelines'... At least from the provided doc, as a solution you can see: https://github.com/zendframework/zend-expressive-skeleton/issues/157
Sorry but I haven't really followed the expressive development. Can you elaborate a bit what changed and what needs to be changed in the middleware to make it work again? Mind providing a PR?
Ideally we could then release a version that is compatible with expressive 2.0 and another release which is only compatible with PHP 7.1.
@shochdoerfer,
expressive 2.0 have introduced the 'programmatic pipelines' (became default) in addition to the existing module based configuration.
In other words, you probably need to update your blog post:
This part is valid for module based config:
At first I had to register a pre_routing middleware in config/autoload/middleware-pipeline.local.php:
return [ 'middleware_pipeline' => [[ 'middleware' => bitExpert\Http\Middleware\Psr7\ Prophiler\ProphilerMiddleware::class, 'priority' => 11000, ]] ];
But with programmatic pipelines, it must be defined in a file (just like for slim I guess)
Adding them in the config/pipeline.php file:
$app->pipe(ErrorHandler::class); //... just after the ErrorHandler::class (must be the first one) $debug = $app->getContainer()->get('config')['debug'] ?? false; if ($debug) { /* 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); //... the rest of the pipeline
Actually there's no issue with your code... It's more about documentation to cover the two alternatives install on expressive.
@shochdoerfer, look at the P/R, if it works with php5 it might be a solution for now (no breaking changes needed). If aliased the dep to 2.0:
"fabfuel/prophiler": "^1.4|dev-feature/php7 as 2.0",
So the dev-feature/php7 will have precedence over 1.4
I need more time to test, because for now, looks the request collector does not give anything under expressive 2.0.
@shochdoerfer should work now, please have a look at the P/R #18 for infos.
Does it make sense to include a default config/pipeline.php
in this package? Is that the way it is supposed to work?
No, when people use programmatic pipelines, they're suppose to code the pipeline. See https://github.com/zendframework/zend-expressive-skeleton/blob/master/config/pipeline.php
So documenting is enough.
@belgattitude mind checking the updated docs please? Thanks. See this PR.
Where you able to fix the problem with the request collector?
Hey @shochdoerfer ,
haven't had the time yet... But I guess this week-end will be possible or Monday.
Fixed with #18
Could not install with PHP7.1.