From 8dba1789e12eddafaa2271ca8536daea59f44eb5 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 18 Jan 2016 16:32:43 -0600 Subject: [PATCH 1/3] Allow using zend-servicemanager v3 Sets the version constraint for zend-servicemanager to `^2.7.3 || ^3.0`, to allow usage of either version. Initial selection will be based on other dependencies. Users can override later to select a more specific version. --- src/ExpressiveInstaller/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ExpressiveInstaller/config.php b/src/ExpressiveInstaller/config.php index 38094e9..1d144c7 100644 --- a/src/ExpressiveInstaller/config.php +++ b/src/ExpressiveInstaller/config.php @@ -12,7 +12,7 @@ 'zendframework/zend-expressive-twigrenderer' => '^1.0', 'zendframework/zend-expressive-zendrouter' => '^1.0', 'zendframework/zend-expressive-zendviewrenderer' => '^1.0', - 'zendframework/zend-servicemanager' => '^2.5', + 'zendframework/zend-servicemanager' => '^2.7.3 || ^3.0', ], 'require-dev' => [ From 7627203b351dcb22d50abd09a0f00ab502b9394c Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 18 Jan 2016 16:44:00 -0600 Subject: [PATCH 2/3] Set new version for zend-expressive-helpers Need the 2.0 version going forward. This also means new configuration for the middleware pipeline. Per zendframework/zend-expressive#270, this patch updates the middleware pipeline to be an array of middleware specifications, each with a priority. It defines three specific pipelines: - "always" is registered at priority 10000, and represents a pipeline of middleware that acts as either pre-conditions or post-routing handlers (e.g., CORS support, WWW-Authentication header injection, etc.). - "routing" is registered at priority 1, and defines a middleware pipeline containing the routing, UrlHelper, and dispatch middleware; any middleware that you might want to have intercept the results of routing could go between them. - "error" is registered at priority -1000, and defines a middleware pipeline for error handlers. --- composer.json | 2 +- .../autoload/middleware-pipeline.global.php | 75 ++++++++++++------- 2 files changed, 51 insertions(+), 26 deletions(-) diff --git a/composer.json b/composer.json index 4ffc88f..2ce7bb4 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "php": "^5.5 || ^7.0", "roave/security-advisories": "dev-master", "zendframework/zend-expressive": "~1.0.0@rc || ^1.0", - "zendframework/zend-expressive-helpers": "^1.3", + "zendframework/zend-expressive-helpers": "^2.0", "zendframework/zend-stdlib": "~2.7" }, "require-dev": { diff --git a/config/autoload/middleware-pipeline.global.php b/config/autoload/middleware-pipeline.global.php index a24125e..6ce8537 100644 --- a/config/autoload/middleware-pipeline.global.php +++ b/config/autoload/middleware-pipeline.global.php @@ -1,4 +1,5 @@ [ - // An array of middleware to register prior to registration of the - // routing middleware - 'pre_routing' => [ - //[ - // Required: - // 'middleware' => 'Name or array of names of middleware services and/or callables', - // Optional: - // 'path' => '/path/to/match', - // 'error' => true, - //], - [ - 'middleware' => [ - Helper\ServerUrlMiddleware::class, - Helper\UrlHelperMiddleware::class, - ], + // An array of middleware to register. Each item is of the following + // specification: + // + // [ + // Required: + // 'middleware' => 'Name or array of names of middleware services and/or callables', + // Optional: + // 'path' => '/path/to/match', // string; literal path prefix to match + // // middleware will not execute + // // if path does not match! + // 'error' => true, // boolean; true for error middleware + // 'priority' => 1, // int; higher values == register early; + // // lower/negative == register last; + // // default is 1, if none is provided. + // ], + // + // While the ApplicationFactory ignores the keys associated with + // specifications, they can be used to allow merging related values + // defined in multiple configuration files/locations. This file defines + // some conventional keys for middleware to execute early, routing + // middleware, and error middleware. + 'always' => [ + 'middleware' => [ + // Add more middleware here that you want to execute on + // every request: + // - bootstrapping + // - pre-conditions + // - modifications to outgoing responses + Helper\ServerUrlMiddleware::class, ], + 'priority' => 10000, ], - // An array of middleware to register after registration of the - // routing middleware - 'post_routing' => [ - //[ - // Required: - // 'middleware' => 'Name of middleware service, or a callable', - // Optional: - // 'path' => '/path/to/match', - // 'error' => true, - //], + 'routing' => [ + 'middleware' => [ + ApplicationFactory::ROUTING_MIDDLEWARE, + Helper\UrlHelperMiddleware::class, + // Add more middleware here that needs to introspect the routing + // results; this might include: + // - route-based authentication + // - route-based validation + // - etc. + ApplicationFactory::DISPATCH_MIDDLEWARE, + ], + 'priority' => 1, + ], + + 'error' => [ + 'middleware' => [ + // Add error middleware here. + ], + 'priority' => -10000, ], ], ]; From cf17bc277a718b9d5238831d3c4c6ea6c6d80077 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 18 Jan 2016 17:45:21 -0600 Subject: [PATCH 3/3] Use --no-dev when installing Otherwise the dev requirements *before they are rewritten by the installer* are used. Also provides a note detailing how to install the dev requirements after installation. --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cade026..239d74f 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ removed. Start your new Expressive project with composer: ```bash -$ composer create-project zendframework/zend-expressive-skeleton +$ composer create-project --no-dev zendframework/zend-expressive-skeleton ``` > ### Release Candidates @@ -39,9 +39,15 @@ $ composer create-project zendframework/zend-expressive-skeleton > To install a release candidate, use the following: > > ```bash -> $ composer create-project zendframework/zend-expressive-skeleton:^1.0@rc +> $ composer create-project --no-dev "zendframework/zend-expressive-skeleton:^1.0@rc" > ``` +> ### Development requirements +> +> If you want Composer to install the development requirements defined by the +> skeleton — specifically PHPUnit and PHP_CodeSniffer — run a `composer update` +> after installing the skeleton. + After choosing and installing the packages you want, go to the `` and start PHP's built-in web server to verify installation: