Skip to content

Instantly share code, notes, and snippets.

Working from home during quarantine. In other words, just like always.

Matthew Weier O'Phinney weierophinney

Working from home during quarantine. In other words, just like always.
Block or report user

Report or block weierophinney

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
weierophinney /
Created Apr 19, 2016
Using the zend-db ConfigProvider within a zend-expressive application
// config/autoload/
$provider = new Zend\Db\ConfigProvider();
return $provider();
weierophinney /
Created Mar 16, 2016
Alternate way to push middleware into the pipeline between routing and dispatch.
use Zend\Expressive\Container\ApplicationFactory;
use Zend\Expressive\Helper;
return [
'middleware_pipeline' => [
'always' => [
'middleware' => [
weierophinney /
Created Mar 3, 2016
Response to twitter comments

I received this comment on twitter earlier today, in response to

"recommended for literally years developers not [lazy load]" - official Zend certification taught it depends on situation!

To this, I have two responses.

When was the certification created?

The certification was created within the first year of the first ZF2 stable release, and is current to ZF 2.2.0. That release was almost three years ago,

weierophinney /
Last active Mar 1, 2016
Testing zend-mvc (future) 2.7.0

How to test zend-mvc 2.7.0

We're prepping a 2.7.0 release of zend-mvc. It has a few features of interest:

  • New middleware dispatcher to allow dispatching PSR-7 middleware from within the zend-mvc workflow.
  • Updates to be forwards-compatible with v3 components.

This latter has been the result of a months of work getting all the components zend-mvc depends on updated, and then updating the plethora of factories, event listeners, and places where events are triggered exposed by zend-mvc to work across both the v2 and v3 versions of zend-servicemanager and zend-eventmanager.

weierophinney / benchmarks-v2.log
Last active Sep 28, 2015
Athletic benchmark results of zend-eventmanager, to detail performance improvements from v2 to v3. Two separate benchmarks are shown for v3, one detailing the original strategy of "prepare shared listeners only on the first trigger" and one detailing the strategy where shared listeners are prepared on every trigger, demonstrating we can do so wi…
View benchmarks-v2.log
Benchmarks from current v2 master.
Method Name Iterations Average Time Ops/second
------------ ------------ ----------------- -------------
trigger : [ 5,000] [0.0001748194695] [5,720.18668]
Method Name Iterations Average Time Ops/second
weierophinney /
Last active Mar 31, 2016
Please help me with a tricky git component split problem

UPDATE: I discovered the issue is with specifying a commit range to filter-branch. When that is omitted, everything works perfectly, including history truncation! Thanks to everyone who assisted with ideas and suggestions!

I am currently working on a project to split the various components of Zend Framework 2 into their own repositories.

Currently, our repository structure looks like this:

weierophinney /
Created May 4, 2015
Summary of PSR-7 changes since Review 2 began.

Summary of changes since Review 2 Started

  • Expanded section on expected structure returned by getUploadedFiles(), with several examples ranging from a flat structure to a nested structure with a collection of files.
  • Clarifications and simplification of URI -> Host header interactions.
    • Updated withUri() to indicate it MUST update the Host header with the value present in the URI provided (if any) UNLESS the $preserveHost flag is boolean true.
weierophinney / CompositeAdapter.php
Created Apr 23, 2015
Example of a composite authentication adapter for zf-mvc-auth
View CompositeAdapter.php
use Zend\Http\Request;
use Zend\Http\Response;;
use ZF\MvcAuth\Authentication\AdapterInterface;
use ZF\MvcAuth\Identity\IdentityInterface;
use ZF\MvcAuth\MvcAuthEvent;
class CompositeAdapter implements AdapterInterface
private $adapters = [];
weierophinney / CallbackStream.php
Last active Mar 31, 2016
Examples of streams you can use for alternate output styles in PSR-7
View CallbackStream.php
* @copyright Copyright (c) 2015 Matthew Weier O'Phinney (
* @license BSD-2-Clause
namespace Psr7Examples;
use Psr\Http\Message\StreamableInterface;
weierophinney / anonymous_middleware.php
Created Feb 24, 2015
Potential use case for anonymous PHP classes to translate between middleware types
View anonymous_middleware.php
$conduit->pipe(new class implements MiddlewareInterface {
public function __invoke($request, $response, $next)
$laravelRequest = mungePsr7ToLaravelRequest($request);
$laravelNext = function ($request) use ($next, $response) {
$request = ;
return $next(mungeLaravelToPsr7Request($request), $response)
$laravelMiddleware = new SomeLaravelMiddleware();
You can’t perform that action at this time.