Skip to content

Commit

Permalink
Merge d601266 into 7ae608f
Browse files Browse the repository at this point in the history
  • Loading branch information
codeliner committed May 7, 2018
2 parents 7ae608f + d601266 commit 7bd322b
Show file tree
Hide file tree
Showing 107 changed files with 404 additions and 5,943 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -32,14 +32,14 @@ before_script:
- mkdir -p "$HOME/.php-cs-fixer"
- cp composer.json.dist composer.json
- cp config/pipeline.php.dist config/pipeline.php
- cp config/development.config.php.dist config/development.config.php
- phpenv config-rm xdebug.ini
- composer self-update
- composer update $DEPENDENCIES
- psql -c 'create database event_store_tests;' -U postgres

script:
- if [[ $TEST_COVERAGE == 'true' ]]; then php -dzend_extension=xdebug.so ./vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml; else ./vendor/bin/phpunit; fi
- rm data/cache/config-cache.php
- ./vendor/bin/php-cs-fixer fix -v --diff --dry-run
- ./vendor/bin/docheader check config/ public/ src/ tests/

Expand Down
30 changes: 15 additions & 15 deletions composer.json.dist
@@ -1,7 +1,7 @@
{
"name": "prooph/event-store-http-api",
"description": "EventStore HTTP API",
"type": "project",
"type": "library",
"license": "BSD-3-Clause",
"homepage": "http://getprooph.org/",
"authors": [
Expand All @@ -25,29 +25,29 @@
],
"require": {
"php": "^7.1",
"guzzlehttp/guzzle": "^6.3",
"php-http/guzzle6-adapter": "^1.1.1",
"psr/container": "^1.0",
"prooph/event-store" : "^7.3.1",
"prooph/pdo-event-store": "^1.6",
"prooph/event-store" : "^7.2",
"prooph/pdo-event-store": "^1.3.3",
"roave/security-advisories": "dev-master",
"sandrokeil/interop-config": "^2.1",
"zendframework/zend-config-aggregator": "^1.0.1",
"zendframework/zend-diactoros": "^1.6.1",
"zendframework/zend-expressive": "^2.1",
"zendframework/zend-expressive-fastroute": "^2.1.2",
"zendframework/zend-expressive-helpers": "^4.2",
"zendframework/zend-servicemanager": "^3.3.1",
"zendframework/zend-config-aggregator": "^1.0",
"zendframework/zend-diactoros": "^1.7.1",
"zendframework/zend-expressive": "^3.0",
"zendframework/zend-expressive-fastroute": "^3.0",
"zendframework/zend-expressive-helpers": "^5.0",
"zendframework/zend-servicemanager": "^3.3",
"zendframework/zend-stdlib": "^3.1",
"zfcampus/zf-development-mode": "^3.1",
"webimpress/http-middleware-compatibility": "^0.1.4"
"prooph/event-store-http-middleware": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "^6.5.5",
"phpunit/phpunit": "^6.0",
"phpspec/prophecy": "^1.7",
"prooph/php-cs-fixer-config": "^0.2.1",
"prooph/php-cs-fixer-config": "^0.2",
"satooshi/php-coveralls": "^1.0",
"malukenho/docheader": "^0.1.4"
"malukenho/docheader": "^0.1.4",
"php-http/guzzle6-adapter": "^1.1.1",
"guzzlehttp/guzzle": "^6.3"
},
"conflict": {
"container-interop/container-interop": "<1.2.0"
Expand Down
18 changes: 12 additions & 6 deletions config/autoload/dependencies.global.php
Expand Up @@ -12,24 +12,28 @@

namespace Prooph\EventStore\Http\Api;

use Interop\Http\Factory\ResponseFactoryInterface;
use Prooph\Common\Messaging\FQCNMessageFactory;
use Prooph\Common\Messaging\MessageConverter;
use Prooph\Common\Messaging\NoOpMessageConverter;
use Prooph\EventStore\Http\Api\Container\Infrastructure\UrlHelperFactory as ProophUrlHelperFactory;
use Prooph\EventStore\Http\Api\Container\Middleware\BaseUrlFactory;
use Prooph\EventStore\Http\Api\Middleware\BaseUrl;
use Prooph\EventStore\Http\Api\Middleware\ResponseFactory;
use Prooph\EventStore\Http\Middleware\Action;
use Prooph\EventStore\Http\Middleware\Container;
use Prooph\EventStore\Http\Middleware\GenericEventFactory;
use Prooph\EventStore\Http\Middleware\JsonTransformer;
use Prooph\EventStore\Http\Middleware\UrlHelper as ProophUrlHelper;
use Zend\Expressive\Application;
use Zend\Expressive\Container\ApplicationFactory;
use Zend\Expressive\Container\ErrorHandlerFactory;
use Zend\Expressive\Container\ErrorResponseGeneratorFactory;
use Zend\Expressive\Container\NotFoundDelegateFactory;
use Zend\Expressive\Container\NotFoundHandlerFactory;
use Zend\Expressive\Delegate\NotFoundDelegate;
use Zend\Expressive\Helper\UrlHelper;
use Zend\Expressive\Helper\UrlHelperFactory;
use Zend\Expressive\Helper\UrlHelperMiddleware;
use Zend\Expressive\Helper\UrlHelperMiddlewareFactory;
use Zend\Expressive\Middleware\ErrorResponseGenerator;
use Zend\Expressive\Middleware\NotFoundHandler;
use Zend\Expressive\Router\FastRouteRouterFactory;
use Zend\Expressive\Router\RouterInterface;
use Zend\ServiceManager\Factory\InvokableFactory;
Expand All @@ -40,6 +44,7 @@
'dependencies' => [
'aliases' => [
MessageConverter::class => NoOpMessageConverter::class,
ResponseFactoryInterface::class => ResponseFactory::class,
],
'factories' => [
// expressive
Expand All @@ -48,11 +53,12 @@
ErrorResponseGenerator::class => ErrorResponseGeneratorFactory::class,
UrlHelper::class => UrlHelperFactory::class,
UrlHelperMiddleware::class => UrlHelperMiddlewareFactory::class,
NotFoundDelegate::class => NotFoundDelegateFactory::class,
NotFoundHandler::class => NotFoundHandlerFactory::class,
OriginalMessages::class => InvokableFactory::class,
RouterInterface::class => FastRouteRouterFactory::class,
BaseUrl::class => BaseUrlFactory::class,
ResponseFactory::class => InvokableFactory::class,
JsonTransformer::class => InvokableFactory::class,
ProophUrlHelper::class => ProophUrlHelperFactory::class,
// app
GenericEventFactory::class => InvokableFactory::class,
// actions
Expand Down
1 change: 1 addition & 0 deletions config/autoload/event_store.local.php.dist
Expand Up @@ -13,6 +13,7 @@ declare(strict_types=1);
namespace Prooph\EventStore\Http\Api;

use Prooph\EventStore\EventStore;
use Prooph\EventStore\Http\Middleware\GenericEventFactory;
use Prooph\EventStore\Pdo\Container\MariaDbProjectionManagerFactory;
use Prooph\EventStore\Pdo\Container\MariaDbEventStoreFactory;
use Prooph\EventStore\Pdo\Container\MySqlProjectionManagerFactory;
Expand Down
9 changes: 7 additions & 2 deletions config/config.php
Expand Up @@ -10,18 +10,23 @@

declare(strict_types=1);

namespace Prooph\EventStore\Http\Api;
namespace Prooph\ProophessorDo;

use Zend\ConfigAggregator\ArrayProvider;
use Zend\ConfigAggregator\ConfigAggregator;
use Zend\ConfigAggregator\PhpFileProvider;

$cacheConfig = [
'config_cache_path' => 'data/cache/config-cache.php',
'config_cache_path' => 'data/config-cache.php',
];

$aggregator = new ConfigAggregator([
new ArrayProvider($cacheConfig),

\Zend\Expressive\Helper\ConfigProvider::class,
\Zend\Expressive\ConfigProvider::class,
\Zend\Expressive\Router\ConfigProvider::class,

new PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
new PhpFileProvider('config/development.config.php'),
], $cacheConfig['config_cache_path']);
Expand Down
2 changes: 2 additions & 0 deletions config/development.config.php.dist
@@ -1,4 +1,6 @@
<?php

declare(strict_types=1);
/**
* This file is part of the prooph/event-store-http-api.
* (c) 2016-2018 prooph software GmbH <contact@prooph.de>
Expand Down
78 changes: 68 additions & 10 deletions config/pipeline.php.dist
Expand Up @@ -10,18 +10,76 @@

declare(strict_types=1);

use Psr\Container\ContainerInterface;
use Zend\Expressive\Application;
use Zend\Expressive\Handler\NotFoundHandler;
use Zend\Expressive\Helper\ServerUrlMiddleware;
use Zend\Expressive\Helper\UrlHelperMiddleware;
use Zend\Expressive\MiddlewareFactory;
use Zend\Expressive\Router\Middleware\DispatchMiddleware;
use Zend\Expressive\Router\Middleware\ImplicitHeadMiddleware;
use Zend\Expressive\Router\Middleware\ImplicitOptionsMiddleware;
use Zend\Expressive\Router\Middleware\MethodNotAllowedMiddleware;
use Zend\Expressive\Router\Middleware\RouteMiddleware;
use Zend\Stratigility\Middleware\ErrorHandler;

/**
* Expressive middleware pipeline
*/
/**
* Setup middleware pipeline:
*/
return function (Application $app, MiddlewareFactory $factory, ContainerInterface $container): void {
// The error handler should be the first (most outer) middleware to catch
// all Exceptions.
$app->pipe(ErrorHandler::class);
$app->pipe(ServerUrlMiddleware::class);

/** @var \Zend\Expressive\Application $app */
$app->pipe(\Zend\Stratigility\Middleware\ErrorHandler::class);

// Uncomment if you want to use a base url, also add a config/autoload/config.local.php with following config:
// return ['http' => ['base_url' => '/custom/base/path']];
//$app->pipe(\Prooph\EventStore\Http\Api\Middleware\BaseUrl::class);
// Uncomment if you want to use a base url, also add a config/autoload/config.local.php with following config:
// return ['http' => ['base_url' => '/custom/base/path']];
//$app->pipe(\Prooph\EventStore\Http\Api\Middleware\BaseUrl::class);

$app->pipeRoutingMiddleware();
$app->pipe(\Zend\Expressive\Helper\UrlHelperMiddleware::class);
$app->pipeDispatchMiddleware();
$app->pipe(\Zend\Expressive\Middleware\NotFoundHandler::class);
// Pipe more middleware here that you want to execute on every request:
// - bootstrapping
// - pre-conditions
// - modifications to outgoing responses
//
// Piped Middleware may be either callables or service names. Middleware may
// also be passed as an array; each item in the array must resolve to
// middleware eventually (i.e., callable or service name).
//
// Middleware can be attached to specific paths, allowing you to mix and match
// applications under a common domain. The handlers in each middleware
// attached this way will see a URI with the matched path segment removed.
//
// i.e., path of "/api/member/profile" only passes "/member/profile" to $apiMiddleware
// - $app->pipe('/api', $apiMiddleware);
// - $app->pipe('/docs', $apiDocMiddleware);
// - $app->pipe('/files', $filesMiddleware);
// Register the routing middleware in the middleware pipeline.
// This middleware registers the Zend\Expressive\Router\RouteResult request attribute.
$app->pipe(RouteMiddleware::class);
// The following handle routing failures for common conditions:
// - HEAD request but no routes answer that method
// - OPTIONS request but no routes answer that method
// - method not allowed
// Order here matters; the MethodNotAllowedMiddleware should be placed
// after the Implicit*Middleware.
$app->pipe(ImplicitHeadMiddleware::class);
$app->pipe(ImplicitOptionsMiddleware::class);
$app->pipe(MethodNotAllowedMiddleware::class);
// Seed the UrlHelper with the routing results:
$app->pipe(UrlHelperMiddleware::class);
// Add more middleware here that needs to introspect the routing results; this
// might include:
//
// - route-based authentication
// - route-based validation
// - etc.
// Register the dispatch middleware in the middleware pipeline
$app->pipe(DispatchMiddleware::class);
// At this point, if no Response is returned by any middleware, the
// NotFoundHandler kicks in; alternately, you can provide other fallback
// middleware to execute.
$app->pipe(NotFoundHandler::class);
};

0 comments on commit 7bd322b

Please sign in to comment.