interface MiddlewareInterface
{
public function process(
ServerRequestInterface $request,
DelegateInterface $delegate
): ResponseInterface
}
class Timer implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
{
$startTime = microtime(true); $response = $delegate->process($request);
return $response->withHeader('X-Timer', sprintf('%2.3fms', (microtime(true) - $startTime) * 1000));
}
}
interface MiddlewareInterface
{
public function process(ServerRequestInterface $request): Generator
}
class Timer implements MiddlewareInterface
{
public function process(ServerRequestInterface $request)
{
$startTime = microtime(true); $response = (yield $request);
return $response->withHeader('X-Timer', sprintf('%2.3fms', (microtime(true) - $startTime) * 1000));
}
}
function dispatch(ServerRequestInterface $request, ResponseInterface $response, array $middleware){ $postProcessors = []; foreach ($middleware as $middleware) { $frame = $middleware($request); if ($frame->valid()) { $request = $frame->current(); $postProcessors[] = $frame; } else { $response = $frame->getResponse(); } }
$postProcessors = array_reverse($postProcessors); foreach ($postProcessors as $frame) { $frame->send($response); $response = $frame->getReturn(); } return $response;}
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscribe@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/8303b4eb-38af-4e2a-b63a-b0f45eafa697%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/php-fig/lkpuaZPcBsY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to php-fig+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAGOJM6%2Bsd%3DrkLQnmUQ_QN6ufqQEwUZiE6_9VUeLN3XX3MSwezw%40mail.gmail.com.
--
You received this message because you are subscribed to a topic in the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/php-fig/lkpuaZPcBsY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to php-fig+unsubscribe@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAJp_myVPNLwXexJs8U_NLdw9Kp1jo3%3Dcei5uh6cr-6ds%2BTwv-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
> This would require >= PHP 7That's a non-starter. There are plenty of people stuck on PHP 5.x for various reasons and I don't want to shut them out.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/715fe4dd-6c95-4964-9f9c-e725e9752dd9%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/77f39329-244d-3936-7f70-ebaec302864b%40garfieldtech.com.
Let's go ahead and target PHP 7.0 for PSR-15 outright.
I think the real problem behind this discussion is PSR versioning. We should address that first, because the process of releasing a new PSR to bump requirements is time consuming and inefficient, as Woody maybe wrote between the lines.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAGOJM6LeMXaMEhcqm6Ue-EsxeMXXeHHJHzJX%3DSyoL568eD2g_g%40mail.gmail.com.
I can see that Woody is feeling strongly in favor of support of PHP 5.6. I assume he knows what he is talking about better than myself and will trust him on that. Let's not waste more time debating on something that can be implemented quickly and easily (with a 1.0 for PHP 5.6 and 2.0 for PHP 7+).
I can see that Woody is feeling strongly in favor of support of PHP 5.6. I assume he knows what he is talking about better than myself and will trust him on that. Let's not waste more time debating on something that can be implemented quickly and easily (with a 1.0 for PHP 5.6 and 2.0 for PHP 7+).
Something like that is pretty stupid. It prevents having an implementation that's compatible with both, 5.6 and 7. And two versions of a package can't be installed side-by-side with Composer. New major versions of PSRs should definitely use new package names for that reason.Regards, Niklas
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscribe@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/2c42d1b9-2881-4495-9686-b516cdaadb86%40googlegroups.com.
Something like that is pretty stupid. It prevents having an implementation that's compatible with both, 5.6 and 7. And two versions of a package can't be installed side-by-side with Composer. New major versions of PSRs should definitely use new package names for that reason.Regards, Niklas
This has been brought up a number of times already, and disregarding it as "stupid" will not drive to a definitive solution.
At PHPDay unconference, participants in the discussion deemed this as generally not much of an issue, mostly because you already have to comply to this constraint anyway: you can't install packages having incompatible dependency graphs, so why bother trying to circumvent this limitation for PSRs only?
While I understand and agree with the principle, in practice the chance of having dependency issues due to migrations between major versions is very high anyway.
That said, if we want to release entirely different PSRs for updated versions (which would be arguably a cleaner solution), I think we need to streamline the process and make it easier, because at the moment it's so much of a PITA that nobody wants to do it.