qlimix / http-diactoros
This package is abandoned and no longer maintained.
No replacement package was suggested.
Http helper interfaces implemented with diactoros and httphandlerrunner
1.0.0
2019-06-17 19:27 UTC
Requires
- php: >=7.2
- psr/http-server-handler: ^1.0
- qlimix/http: ^1.0
- zendframework/zend-diactoros: ^2.1
- zendframework/zend-httphandlerrunner: ^1.1
Requires (Dev)
- qlimix/code-standard: ^1.0
This package is auto-updated.
Last update: 2020-12-17 23:24:38 UTC
README
Http helper interfaces implemented with diactoros and httphandlerrunner.
Install
Using Composer:
$ composer require qlimix/http-diactoros
usage
Request building:
<?php use Qlimix\Http\Request\DiactorosServerRequestBuilder; $builder = new DiactorosServerRequestBuilder(); $builder->build(); $builder->buildFromGlobals();
Json response:
<?php use Qlimix\Http\Response\DiactorosJsonResponse; $response = new DiactorosJsonResponse(); $response->response([], 200, ['x-foo' => 'foobar']);
No content response:
<?php use Qlimix\Http\Response\DiactorosNoContent; $response = new DiactorosNoContent(); $response->noContent();
Response emitting:
<?php use Qlimix\Http\Response\HandlerRunnerResponseEmitter; use Qlimix\Http\Response\DiactorosJsonResponse; use Zend\HttpHandlerRunner\Emitter\SapiEmitter; $responseCreation = new DiactorosJsonResponse(); $response = $responseCreation->response([], 200, ['x-foo' => 'foobar']); $emitter = new SapiEmitter(); $responseEmitter = new HandlerRunnerResponseEmitter($emitter); $responseEmitter->emit($response);
Testing
To run all unit tests locally with PHPUnit:
$ vendor/bin/phpunit
Quality
To ensure code quality run grumphp which will run all tools:
$ vendor/bin/grumphp run
Contributing
Please see CONTRIBUTING for details.