Skip to content

Commit

Permalink
updated http-middleware interface to 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Nov 27, 2016
1 parent ec0e275 commit 40574db
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 0.2.0 - 2016-11-27

### Changed

* Updated to `http-interop/http-middleware#0.3`

## 0.1.0 - 2016-10-08

First version
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# middlewares/aura-session

[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Software License][ico-license]](LICENSE)
[![Build Status][ico-travis]][link-travis]
[![Quality Score][ico-scrutinizer]][link-scrutinizer]
[![Total Downloads][ico-downloads]][link-downloads]
[![SensioLabs Insight][ico-sensiolabs]][link-sensiolabs]

Middleware to manage sessions using [Aura.Session](https://github.com/auraphp/Aura.Session).

**Note:** This middleware is intended for server side only

## Requirements

* PHP >= 5.6
* A [PSR-7](https://packagist.org/providers/psr/http-message-implementation) http mesage implementation ([Diactoros](https://github.com/zendframework/zend-diactoros), [Guzzle](https://github.com/guzzle/psr7), [Slim](https://github.com/slimphp/Slim), etc...)
* A [PSR-15](https://github.com/http-interop/http-middleware) middleware dispatcher ([Middleman](https://github.com/mindplay-dk/middleman), etc...)
* A [PSR-15 middleware dispatcher](https://github.com/middlewares/awesome-psr15-middlewares#dispatcher)

## Installation

Expand Down Expand Up @@ -52,7 +50,7 @@ The session name. If it's not defined, the default `PHPSESSID` will be used.

#### `attribute(string $attribute)`

The attribute name used to store the session in the session request. By default is `session`.
The attribute name used to store the session in the server request. By default is `session`.

---

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
},
"require": {
"php": "^5.6 || ^7.0",
"http-interop/http-middleware": "^0.2",
"http-interop/http-middleware": "^0.3",
"aura/session": "^2.1"
},
"require-dev": {
"phpunit/phpunit": "^5.5",
"zendframework/zend-diactoros": "^1.3",
"friendsofphp/php-cs-fixer": "^1.12",
"squizlabs/php_codesniffer": "^2.7",
"mindplay/middleman": "^2.0"
"middlewares/utils": "~0.5"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 5 additions & 3 deletions tests/AuraSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@
namespace Middlewares\Tests;

use Middlewares\AuraSession;
use Middlewares\Utils\Dispatcher;
use Middlewares\Utils\CallableMiddleware;
use Zend\Diactoros\ServerRequest;
use Zend\Diactoros\Response;
use mindplay\middleman\Dispatcher;

class AuraSessionTest extends \PHPUnit_Framework_TestCase
{
public function testAuraSession()
{
$response = (new Dispatcher([
(new AuraSession())->name('custom-session'),
function ($request) {
new CallableMiddleware(function ($request) {
$session = $request->getAttribute('session');
$this->assertInstanceOf('Aura\\Session\\Session', $session);

$response = new Response();
$response->getBody()->write($session->getName());

return $response;
},
}),
]))->dispatch(new ServerRequest());

$this->assertInstanceOf('Psr\\Http\\Message\\ResponseInterface', $response);
Expand Down

0 comments on commit 40574db

Please sign in to comment.