Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #450 from xtreamwayz/hotfix/psr-11
Browse files Browse the repository at this point in the history
Add PSR-11 support

Conflicts:
	composer.lock
weierophinney committed Feb 15, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 1531e4d + 1758878 commit 7e32d99
Showing 51 changed files with 173 additions and 161 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ features:
- [Aura.Router](https://github.com/auraphp/Aura.Router)
- [FastRoute](https://github.com/nikic/FastRoute)
- [zend-router](https://github.com/zendframework/zend-expressive-router)
- DI Containers, via [container-interop](https://github.com/container-interop/container-interop).
- DI Containers, via [PSR-11 Container](https://github.com/php-fig/container).
Middleware matched via routing is retrieved from the composed container.
- Optionally, templating. We support:
- [Plates](http://platesphp.com/)
@@ -68,7 +68,7 @@ We currently support and provide the following routing integrations:
`composer require zendframework/zend-expressive-zendrouter`

We recommend using a dependency injection container, and typehint against
[container-interop](https://github.com/container-interop/container-interop). We
[PSR-11 Container](https://github.com/php-fig/container). We
can recommend the following implementations:

- [zend-servicemanager](https://github.com/zendframework/zend-servicemanager):
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
},
"require": {
"php": "^5.6 || ^7.0",
"container-interop/container-interop": "^1.1",
"psr/container": "^1.0",
"psr/http-message": "^1.0",
"zendframework/zend-diactoros": "^1.1",
"zendframework/zend-expressive-router": "^2.1",
@@ -36,6 +36,9 @@
"zendframework/zend-expressive-zendrouter": "^2.0",
"zendframework/zend-servicemanager": "^2.6 || ^3.1.1"
},
"conflict": {
"container-interop/container-interop": "<1.2.0"
},
"autoload": {
"psr-4": {
"Zend\\Expressive\\": "src/"
170 changes: 88 additions & 82 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion doc/book/cookbook/autowiring-routes-and-pipelines.md
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ the following contents:
namespace App\Factory;

use App\Action;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Zend\Expressive\Application;
use Zend\Expressive\Helper\ServerUrlMiddleware;
use Zend\Expressive\Helper\UrlHelperMiddleware;
4 changes: 2 additions & 2 deletions doc/book/cookbook/route-specific-pipeline.md
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ You can do this programmatically within a container factory, assuming you are
using a container that supports factories.

```php
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Zend\Stratigility\MiddlewarePipe;

class ApiResourcePipelineFactory
@@ -58,7 +58,7 @@ middleware in order to change the instance or return an alternate instance. In
this case, we'd do the latter. The following is an example:

```php
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Zend\ServiceManager\DelegatorFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\Stratigility\MiddlewarePipe;
4 changes: 2 additions & 2 deletions doc/book/cookbook/setting-locale-without-routing-parameter.md
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ Then you will need a factory for the `SetLocaleMiddleware` to inject the
<?php
namespace Application\I18n;

use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Zend\Expressive\Helper\UrlHelper;

class SetLocaleMiddlewareFactory
@@ -217,7 +217,7 @@ following would work for the above middleware:
```php
namespace Application\Action;

use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Zend\Expressive\Helper\UrlHelper;

class RedirectActionFactory
4 changes: 2 additions & 2 deletions doc/book/cookbook/using-zend-form-view-helpers.md
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ zend-form component (or whichever other components you wish to use).
```php
namespace Your\Application;

use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Zend\ServiceManager\Config;
use Zend\View\HelperPluginManager;

@@ -96,7 +96,7 @@ You'll first need to create a delegator factory:
```php
namespace Your\Application;

use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Zend\ServiceManager\Config;
use Zend\ServiceManager\DelegatorFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
10 changes: 5 additions & 5 deletions doc/book/features/application.md
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ following constructor:
```php
/**
* @param Zend\Expressive\Router\RouterInterface $router
* @param null|Interop\Container\ContainerInterface $container IoC container from which to pull services, if any.
* @param null|Psr\Container\ContainerInterface $container IoC container from which to pull services, if any.
* @param null|Interop\Http\ServerMiddleware\DelegateInterface $defaultDelegate
* Delegate to invoke when the internal middleware pipeline is exhausted
* without returning a response.
@@ -47,7 +47,7 @@ following constructor:
*/
public function __construct(
Zend\Expressive\Router\RouterInterface $router,
Interop\Container\ContainerInterface $container = null,
Psr\Container\ContainerInterface $container = null,
Interop\Http\ServerMiddleware\DelegateInterface $defaultDelegate = null,
Zend\Diactoros\Response\EmitterInterface $emitter = null
);
@@ -58,15 +58,15 @@ following constructor:
```php
/**
* @param Zend\Expressive\Router\RouterInterface $router
* @param null|Interop\Container\ContainerInterface $container IoC container from which to pull services, if any.
* @param null|Psr\Container\ContainerInterface $container IoC container from which to pull services, if any.
* @param null|callable $finalHandler Final handler to use when $out is not
* provided on invocation.
* @param null|Zend\Diactoros\Response\EmitterInterface $emitter Emitter to use when `run()` is
* invoked.
*/
public function __construct(
Zend\Expressive\Router\RouterInterface $router,
Interop\Container\ContainerInterface $container = null,
Psr\Container\ContainerInterface $container = null,
callable $finalHandler = null,
Zend\Diactoros\Response\EmitterInterface $emitter = null
);
@@ -84,7 +84,7 @@ to use. It has the following signature:

```php
AppFactory::create(
Interop\Container\ContainerInterface $container = null,
Psr\Container\ContainerInterface $container = null,
Zend\Expressive\Router\RouterInterface $router = null
);
```
7 changes: 4 additions & 3 deletions doc/book/features/container/factories.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Provided Factories

Expressive provides several factories compatible with container-interop to
facilitate setting up common dependencies. The following is a list of provided
Expressive provides several factories compatible with
[PSR-11 Container](https://github.com/php-fig/container) to facilitate
setting up common dependencies. The following is a list of provided
containers, what they will create, the suggested service name, and any
additional dependencies they may require.

All factories, unless noted otherwise, are in the `Zend\Expressive\Container`
namespace, and define an `__invoke()` method that accepts an
`Interop\Container\ContainerInterface` instance as the sole argument.
`Psr\Container\ContainerInterface` instance as the sole argument.

## ApplicationFactory

2 changes: 1 addition & 1 deletion doc/book/features/container/intro.md
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ middleware when ready to dispatch it; this encourages the idea of defining
middleware-specific dependencies, and factories for ensuring they are injected.

To facilitate this and allow you as a developer to choose the container you
prefer, zend-expressive typehints against [container-interop](https://github.com/container-interop/container-interop),
prefer, zend-expressive typehints against [PSR-11 Container](https://github.com/php-fig/container),
and throughout this manual, we attempt to show using a variety of containers in
examples.

Loading

0 comments on commit 7e32d99

Please sign in to comment.