Skip to content

Commit 81c915c

Browse files
committed
updated http-middleware interface to 0.3
1 parent 3ec9c7f commit 81c915c

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## 0.2.0 - 2016-11-27
8+
9+
### Changed
10+
11+
* Updated to `http-interop/http-middleware#0.3`
12+
713
## 0.1.0 - 2016-10-10
814

915
First version

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
# middlewares/geolocation
22

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

1010
Middleware to geolocate the client using the ip address and [Geocoder](https://github.com/geocoder-php/Geocoder) and save the result as a request attribute.
1111

12-
**Note:** This middleware is intended for server side only
13-
1412
## Requirements
1513

1614
* PHP >= 5.6
1715
* 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...)
18-
* A [PSR-15](https://github.com/http-interop/http-middleware) middleware dispatcher ([Middleman](https://github.com/mindplay-dk/middleman), etc...)
16+
* A [PSR-15 middleware dispatcher](https://github.com/middlewares/awesome-psr15-middlewares#dispatcher)
1917

2018
## Installation
2119

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
},
2020
"require": {
2121
"php": "^5.6 || ^7.0",
22-
"http-interop/http-middleware": "^0.2",
22+
"http-interop/http-middleware": "^0.3",
2323
"willdurand/geocoder": "^3.3"
2424
},
2525
"require-dev": {
2626
"phpunit/phpunit": "^5.5",
2727
"zendframework/zend-diactoros": "^1.3",
2828
"friendsofphp/php-cs-fixer": "^1.12",
2929
"squizlabs/php_codesniffer": "^2.7",
30-
"mindplay/middleman": "^2.0"
30+
"middlewares/utils": "~0.5"
3131
},
3232
"autoload": {
3333
"psr-4": {

tests/GeolocationTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
namespace Middlewares\Tests;
44

55
use Middlewares\Geolocation;
6+
use Middlewares\Utils\Dispatcher;
7+
use Middlewares\Utils\CallableMiddleware;
68
use Zend\Diactoros\ServerRequest;
79
use Zend\Diactoros\Response;
8-
use mindplay\middleman\Dispatcher;
910

1011
class GeolocationTest extends \PHPUnit_Framework_TestCase
1112
{
@@ -15,14 +16,14 @@ public function testGeolocation()
1516

1617
$response = (new Dispatcher([
1718
new Geolocation(),
18-
function ($request) {
19+
new CallableMiddleware(function ($request) {
1920
$address = $request->getAttribute('client-location');
2021

2122
$response = new Response();
2223
$response->getBody()->write($address->first()->getCountry());
2324

2425
return $response;
25-
},
26+
}),
2627
]))->dispatch($request);
2728

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

0 commit comments

Comments
 (0)