Skip to content
This repository was archived by the owner on Jul 6, 2024. It is now read-only.

Commit 079d376

Browse files
author
Dominik Zogg
committed
Merge branch 'master' into v4
2 parents 7e4bf8f + d13504e commit 079d376

15 files changed

+355
-25
lines changed

.travis.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1+
dist: bionic
2+
13
language: php
24

35
matrix:
46
include:
57
- php: 7.2
6-
env: dependencies=lowest
8+
env: composerargs="--prefer-lowest"
79
- php: 7.2
810
- php: 7.3
9-
env: dependencies=lowest
11+
env: composerargs="--prefer-lowest"
1012
- php: 7.3
1113
- php: 7.4
12-
env: dependencies=lowest
14+
env: composerargs="--prefer-lowest"
1315
- php: 7.4
16+
- php: nightly
17+
env: composerargs="--ignore-platform-reqs"
18+
allow_failures:
19+
- php: nightly
1420

1521
before_script:
16-
- echo 'extension=apcu.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/apcu.ini
22+
- (phpenv config-rm xdebug.ini || exit 0)
23+
- pecl install pcov
1724
- echo 'Europe/Zurich' | sudo tee /etc/timezone
1825
- echo 'date.timezone = "Europe/Zurich"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
1926
- composer self-update -q
2027
- composer global require hirak/prestissimo
21-
- if [ -z "$dependencies" ]; then composer update -n; fi;
22-
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest -n; fi;
28+
- composer update $composerargs -n
2329

2430
script:
2531
- composer test

README.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
[![Build Status](https://api.travis-ci.org/chubbyphp/chubbyphp-api-http.png?branch=master)](https://travis-ci.org/chubbyphp/chubbyphp-api-http)
44
[![Coverage Status](https://coveralls.io/repos/github/chubbyphp/chubbyphp-api-http/badge.svg?branch=master)](https://coveralls.io/github/chubbyphp/chubbyphp-api-http?branch=master)
5+
[![Latest Stable Version](https://poser.pugx.org/chubbyphp/chubbyphp-api-http/v/stable.png)](https://packagist.org/packages/chubbyphp/chubbyphp-api-http)
56
[![Total Downloads](https://poser.pugx.org/chubbyphp/chubbyphp-api-http/downloads.png)](https://packagist.org/packages/chubbyphp/chubbyphp-api-http)
67
[![Monthly Downloads](https://poser.pugx.org/chubbyphp/chubbyphp-api-http/d/monthly)](https://packagist.org/packages/chubbyphp/chubbyphp-api-http)
7-
[![Latest Stable Version](https://poser.pugx.org/chubbyphp/chubbyphp-api-http/v/stable.png)](https://packagist.org/packages/chubbyphp/chubbyphp-api-http)
8-
[![Latest Unstable Version](https://poser.pugx.org/chubbyphp/chubbyphp-api-http/v/unstable)](https://packagist.org/packages/chubbyphp/chubbyphp-api-http)
8+
[![Daily Downloads](https://poser.pugx.org/chubbyphp/chubbyphp-api-http/d/daily)](https://packagist.org/packages/chubbyphp/chubbyphp-api-http)
99

1010
## Description
1111

@@ -15,7 +15,7 @@ A simple http handler implementation for API.
1515

1616
* php: ^7.2
1717
* chubbyphp/chubbyphp-deserialization: ^3.0
18-
* chubbyphp/chubbyphp-negotiation: ^1.5.3
18+
* chubbyphp/chubbyphp-negotiation: ^1.6
1919
* chubbyphp/chubbyphp-serialization: ^3.0
2020
* psr/http-factory: ^1.0.1
2121
* psr/http-message: ^1.0.1
@@ -33,24 +33,32 @@ composer require chubbyphp/chubbyphp-api-http "^4.0"
3333
## Usage
3434

3535
* [ApiProblem (example)][2]
36-
* [RequestManager][3]
37-
* [ResponseManager][4]
38-
* [AcceptAndContentTypeMiddleware][5]
39-
* [ApiExceptionMiddleware][6]
40-
* [ApiHttpServiceFactory][7]
41-
* [ApiHttpServiceProvider][8]
42-
* [ApiProblemMapping (example)][9]
36+
* [AcceptAndContentTypeMiddlewareFactory][3]
37+
* [ApiExceptionMiddlewareFactory][4]
38+
* [RequestManagerFactory][5]
39+
* [ResponseManagerFactory][6]
40+
* [RequestManager][7]
41+
* [ResponseManager][8]
42+
* [AcceptAndContentTypeMiddleware][9]
43+
* [ApiExceptionMiddleware][10]
44+
* [ApiHttpServiceFactory][11]
45+
* [ApiHttpServiceProvider][12]
46+
* [ApiProblemMapping (example)][13]
4347

4448
## Copyright
4549

4650
Dominik Zogg 2020
4751

4852
[1]: https://packagist.org/packages/chubbyphp/chubbyphp-api-http
4953
[2]: doc/ApiProblem/ApiProblem.md
50-
[3]: doc/Manager/RequestManager.md
51-
[4]: doc/Manager/ResponseManager.md
52-
[5]: doc/Middleware/AcceptAndContentTypeMiddleware.md
53-
[6]: doc/ServiceFactory/ApiExceptionMiddleware.md
54-
[7]: doc/ServiceFactory/ApiHttpServiceFactory.md
55-
[8]: doc/ServiceProvider/ApiHttpServiceProvider.md
56-
[9]: doc/Serialization/ApiProblemMapping.md
54+
[3]: doc/Container/AcceptAndContentTypeMiddlewareFactory.md
55+
[4]: doc/Container/ApiExceptionMiddlewareFactory.md
56+
[5]: doc/Container/RequestManagerFactory.md
57+
[6]: doc/Container/ResponseManagerFactory.md
58+
[7]: doc/Manager/RequestManager.md
59+
[8]: doc/Manager/ResponseManager.md
60+
[9]: doc/Middleware/AcceptAndContentTypeMiddleware.md
61+
[10]: doc/Middleware/ApiExceptionMiddleware.md
62+
[11]: doc/ServiceFactory/ApiHttpServiceFactory.md
63+
[12]: doc/ServiceProvider/ApiHttpServiceProvider.md
64+
[13]: doc/Serialization/ApiProblemMapping.md

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"require": {
1313
"php": "^7.2",
1414
"chubbyphp/chubbyphp-deserialization": "^3.0@dev",
15-
"chubbyphp/chubbyphp-negotiation": "^1.5.3",
15+
"chubbyphp/chubbyphp-negotiation": "^1.6",
1616
"chubbyphp/chubbyphp-serialization": "^3.0@dev",
1717
"psr/http-factory": "^1.0.1",
1818
"psr/http-message": "^1.0.1",
@@ -65,6 +65,6 @@
6565
"test:lint": "mkdir -p build && find src tests -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php -l | tee build/phplint.log",
6666
"test:loc": "mkdir -p build && vendor/bin/phploc src --verbose | tee build/phploc.log",
6767
"test:static-analysis": "mkdir -p build && bash -c 'vendor/bin/phpstan analyse src --no-progress --level=7 --error-format=junit | tee build/phpstan.junit.xml; if [ ${PIPESTATUS[0]} -ne \"0\" ]; then exit 1; fi'",
68-
"test:unit": "phpdbg -qrr vendor/bin/phpunit --testsuite=Unit --coverage-text --coverage-clover=build/phpunit/clover.xml --coverage-html=build/phpunit/coverage-html --coverage-xml=build/phpunit/coverage-xml --log-junit=build/phpunit/junit.xml --cache-result-file=build/phpunit/result.cache"
68+
"test:unit": "vendor/bin/phpunit --testsuite=Unit --coverage-text --coverage-clover=build/phpunit/clover.xml --coverage-html=build/phpunit/coverage-html --coverage-xml=build/phpunit/coverage-xml --log-junit=build/phpunit/junit.xml --cache-result-file=build/phpunit/result.cache"
6969
}
7070
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# AcceptAndContentTypeMiddlewareFactory
2+
3+
```php
4+
<?php
5+
6+
use Chubbyphp\ApiHttp\Container\AcceptAndContentTypeMiddlewareFactory;
7+
use Psr\Container\ContainerInterface;
8+
9+
$factory = new AcceptAndContentTypeMiddlewareFactory();
10+
11+
$acceptAndContentTypeMiddleware = $factory($container);
12+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ApiExceptionMiddlewareFactory
2+
3+
```php
4+
<?php
5+
6+
use Chubbyphp\ApiHttp\Container\ApiExceptionMiddlewareFactory;
7+
use Psr\Container\ContainerInterface;
8+
9+
$factory = new ApiExceptionMiddlewareFactory();
10+
11+
$apiExceptionMiddleware = $factory($container);
12+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# RequestManagerFactory
2+
3+
```php
4+
<?php
5+
6+
use Chubbyphp\ApiHttp\Container\RequestManagerFactory;
7+
use Psr\Container\ContainerInterface;
8+
9+
$factory = new RequestManagerFactory();
10+
11+
$requestManager = $factory($container);
12+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ResponseManagerFactory
2+
3+
```php
4+
<?php
5+
6+
use Chubbyphp\ApiHttp\Container\ResponseManagerFactory;
7+
use Psr\Container\ContainerInterface;
8+
9+
$factory = new ResponseManagerFactory();
10+
11+
$requestManager = $factory($container);
12+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Chubbyphp\ApiHttp\Container;
6+
7+
use Chubbyphp\ApiHttp\Manager\ResponseManagerInterface;
8+
use Chubbyphp\ApiHttp\Middleware\AcceptAndContentTypeMiddleware;
9+
use Chubbyphp\Negotiation\AcceptNegotiatorInterface;
10+
use Chubbyphp\Negotiation\ContentTypeNegotiatorInterface;
11+
use Psr\Container\ContainerInterface;
12+
13+
final class AcceptAndContentTypeMiddlewareFactory
14+
{
15+
public function __invoke(ContainerInterface $container): AcceptAndContentTypeMiddleware
16+
{
17+
return new AcceptAndContentTypeMiddleware(
18+
$container->get(AcceptNegotiatorInterface::class),
19+
$container->get(ContentTypeNegotiatorInterface::class),
20+
$container->get(ResponseManagerInterface::class)
21+
);
22+
}
23+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Chubbyphp\ApiHttp\Container;
6+
7+
use Chubbyphp\ApiHttp\Manager\ResponseManagerInterface;
8+
use Chubbyphp\ApiHttp\Middleware\ApiExceptionMiddleware;
9+
use Psr\Container\ContainerInterface;
10+
use Psr\Log\LoggerInterface;
11+
12+
final class ApiExceptionMiddlewareFactory
13+
{
14+
public function __invoke(ContainerInterface $container): ApiExceptionMiddleware
15+
{
16+
return new ApiExceptionMiddleware(
17+
$container->get(ResponseManagerInterface::class),
18+
$container->get('config')['debug'],
19+
$container->get(LoggerInterface::class)
20+
);
21+
}
22+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Chubbyphp\ApiHttp\Container;
6+
7+
use Chubbyphp\ApiHttp\Manager\RequestManager;
8+
use Chubbyphp\ApiHttp\Manager\RequestManagerInterface;
9+
use Chubbyphp\Deserialization\DeserializerInterface;
10+
use Psr\Container\ContainerInterface;
11+
12+
final class RequestManagerFactory
13+
{
14+
public function __invoke(ContainerInterface $container): RequestManagerInterface
15+
{
16+
return new RequestManager(
17+
$container->get(DeserializerInterface::class)
18+
);
19+
}
20+
}

0 commit comments

Comments
 (0)