Roadmap: Expressive 2.2

Now that Expressive 3 is in feature freeze, we can finally prepare a v2.2 release with backports and deprecations.

At this time, I’ve identified the following changes we need to make:

zend-stratigility 2.2

This is prepared already, and only needs to be tagged. I haven’t done so yet, so as to prevent deprecation notices from appearing in existing Expressive applications.

zend-expressive-router 2.4

  • Import the ImplicitOptionsMiddleware and ImplicitHeadMiddleware from
    Expressive into the Zend\Expressive\Router\Middleware namespace.

    • ImplicitHeadMiddleware should accept an optional second argument to its
      constructor, a callable stream factory.
  • Move the new middleware into the Middleware subnamespace; the existing
    middleware will be marked deprecated, and extend the new versions.

  • Add factories for all middleware that have constructor requirements.

  • Add a ConfigProvider, mapping middleware classes as required.

  • Mark the RouteResult::getMiddleware() method as deprecated, indicating that
    route results will become middleware in future iterations.

  • Modifiy Route::__construct() to trigger a deprecation notice when a
    $middleware argument that is not a MiddlewareInterface is provided.

zend-expressive 2.2

  • Update to zend-stratigility 2.2 and up.

  • Update to zend-expressive-router 2.4 and up.

  • Create a Zend\Expressive\ConfigProvider with the default service mappings
    that are currently present in the skeleton. Alias deprecated functionality to
    new functionality as it is created, and add any new services in as required.

  • Create Zend\Expressive\Container\ApplicationConfigInjectionDelegator. The
    class should inline the code from the ApplicationConfigInjectionTrait,
    modifying it to operate on a provided $application instance.

    The ApplicationConfigInjectionTrait should be updated to use the static
    methods of the delegator, passing the current $this as the $application
    argument. When called, the two methods defined should raise deprecation
    notices. The trait itself should be marked deprecated.

  • Create a Zend\Expressive\Container\ResponseFactoryFactory
    This should create a PHP closure around creation of a response instance; pull
    it from the 3.0.0 branch. Map it in the config provider to the PSR-7
    ResponseInterface.

  • Create a Zend\Expressive\Container\StreamFactoryFactory
    This should create a PHP closure around creation of a PSR-7 stream instance;
    pull it from the 3.0.0 branch. Map it in the config provider to the PSR-7
    StreamInterface.

  • Modify the MarshalMiddlewareTrait:

    • When the routing/dispatch middleware constants are encountered:

      • Raise a deprecation notice, detailing proper usage.

      • Create and use instances of the zend-expressive-router middleware.

    • When double-pass middleware is encountered, raise a deprecation error,
      detailing how to modify your code to use a Stratigility decorator and the
      response factory.

    • Mark the trait as deprecated.

  • Create a new class, Zend\Expressive\Handler\NotFoundHandler, based on
    Zend\Expressive\Delegate\NotFoundDelegate. Map the DefaultDelegate service
    to the factory for this class. (The factory will need to be marked deprecated
    as well, since it will have a naming conflict with the factory for the
    Zend\Expressive\Middleware\NotFoundHandler factory.)

  • Update Zend\Expressive\Middleware\NotFoundHandler

    • Decorate the above NotFoundHandler instance as middleware.
    • Update its factory accordingly.
    • Mark it as deprecated.
  • Mark deprecated classes and traits:

    • Zend\Expressive\AppFactory. Emit a deprecation notice from the constructor
      indicating it’s going away, and to either instantiate Application
      directly, or use a container to create an instance.

    • Zend\Expressive\Container\NotFoundDelegateFactory.

    • Zend\Expressive\Delegate\NotFoundDelegate. Have it extend the above
      NotFoundHandler.

    • Zend\Expressive\Emitter\EmitterStack.

    • Zend\Expressive\IsCallableInteropMiddlewareTrait

    • Zend\Expressive\Middleware\DispatchMiddleware; extend from
      zend-expressive-router implementation, and have the constructor raise a
      deprecation notice. Its factory should extend the canonical
      zend-expressive-router factory, and also be marked deprecated.

    • Zend\Expressive\Middleware\ImplicitHeadMiddleware; extend from
      zend-expressive-router implementation, and have the constructor raise a
      deprecation notice. Its factory should extend the canonical
      zend-expressive-router factory, and also be marked deprecated…

    • Zend\Expressive\Middleware\ImplicitOptionsMiddleware; extend from
      zend-expressive-router implementation, and have the constructor raise a
      deprecation notice. Its factory should extend the canonical
      zend-expressive-router factory, and also be marked deprecated…

    • Zend\Expressive\Middleware\RouteMiddleware; extend from
      zend-expressive-router implementation, and have the constructor raise a
      deprecation notice. Its factory should extend the canonical
      zend-expressive-router factory, and also be marked deprecated…

  • Modify Application:

    • Mark deprecated methods:
      • pipeRoutingMiddleware(): have this raise a deprecation notice indicating
        how to pipe().

      • pipeDispatchMiddleware(): have this raise a deprecation notice indicating
        how to pipe().

      • getContainer()

      • getDefaultDelegate()

      • getEmitter()