zend-expressive-test/config/container.php

34 lines
1.2 KiB
PHP

<?php
use Test\App\HomeAction;
use Test\App\HomeFactory;
use Test\App\DummyRenderer;
use Xtreamwayz\Pimple\Container;
use Zend\Expressive\Application;
use Zend\Expressive\Container\ApplicationFactory;
use Zend\Expressive\Helper\UrlHelper;
use Zend\Expressive\Helper\UrlHelperFactory;
use Zend\Expressive\Helper\UrlHelperMiddleware;
use Zend\Expressive\Helper\UrlHelperMiddlewareFactory;
use Zend\Expressive\Router\FastRouteRouter;
use Zend\Expressive\Router\RouterInterface;
use Zend\Expressive\Template\TemplateRendererInterface;
$c = new Container;
$c['config'] = require 'config/config.php';
$c[RouterInterface::class] = function () { return new FastRouteRouter; };
$c[UrlHelper::class] = new UrlHelperFactory;
$c[UrlHelperMiddleware::class] = new UrlHelperMiddlewareFactory;
$c[HomeAction::class] = new HomeFactory;
$c[TemplateRendererInterface::class] = function () { return new DummyRenderer; };
$c['Zend\Expressive\Whoops'] = function () { return new Whoops\Run; };
$c['Zend\Expressive\WhoopsPageHandler'] = function () { return new Whoops\Handler\PrettyPageHandler; };
$c['Zend\Expressive\FinalHandler'] = new Zend\Expressive\Container\WhoopsErrorHandlerFactory;
$c[Application::class] = new ApplicationFactory;
return $c;