zapheus / psr-07-bridge
PSR-07 bridge for Zapheus framework.
v0.1.2
2018-04-18 03:21 UTC
Requires
- php: >=5.3.0
- psr/http-message: ~1.0
- zapheus/zapheus: ~0.1
Requires (Dev)
- phpunit/phpunit: ~4.2|~5.7
- scrutinizer/ocular: ~1.1.0
This package is auto-updated.
Last update: 2024-11-05 00:10:39 UTC
README
Converts PSR-07 packages to Zapheus HTTP messages and vice versa. Also contains an implementation of PSR-07.
Installation
Install PSR-07 Bridge
via Composer:
$ composer require zapheus/psr-07-bridge
Basic Usage
PSR-07 to Zapheus
Install a PSR-07 compliant package first (e.g Diactoros):
$ composer require zendframework/zend-diactoros
use Zapheus\Bridge\Psr\Zapheus\Request; use Zend\Diactoros\ServerRequestFactory; $psr = ServerRequestFactory::fromGlobals(); // Zapheus\Http\Message\RequestInterface $request = new Request($psr);
Zapheus to PSR-07
use Zapheus\Bridge\Psr\Interop\ServerRequest; use Zapheus\Container\Container; use Zapheus\Http\Message\RequestInterface; use Zapheus\Http\MessageProvider; $interface = RequestInterface::class; $provider = new MessageProvider; $container = $provider->register(new Container); $zapheus = $container->get($interface); // Psr\Http\Message\ServerRequestInterface $request = new ServerRequest($zapheus);
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Credits
License
The MIT License (MIT). Please see LICENSE for more information.