All Projects → narrowspark → http-emitter

narrowspark / http-emitter

Licence: MIT license
📡 Emitting psr-7 responses.

Programming Languages

PHP
23972 projects - #3 most used programming language
Dockerfile
14818 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to http-emitter

create-music-stream
Creates a PCM 16 bit Little Endian Stream from a mp3 file or youtube video
Stars: ✭ 21 (-32.26%)
Mutual labels:  stream
swoole api framework
swoole
Stars: ✭ 28 (-9.68%)
Mutual labels:  swoole
AnimeDLR
AnimeDLR
Stars: ✭ 47 (+51.61%)
Mutual labels:  stream
mock-hls-server
Fake a live/event HLS stream from a VOD one. Useful for testing. Supports looping.
Stars: ✭ 61 (+96.77%)
Mutual labels:  stream
missive
Fast, lightweight library for encoding and decoding JSON messages over streams.
Stars: ✭ 16 (-48.39%)
Mutual labels:  stream
log
A thin (and fast) PSR-3 logger.
Stars: ✭ 45 (+45.16%)
Mutual labels:  stream
TT Jobs
基于 Swoole 定时管理系统
Stars: ✭ 22 (-29.03%)
Mutual labels:  swoole
orange
基于beanstalkd实现多进程处理消息队列的框架
Stars: ✭ 19 (-38.71%)
Mutual labels:  swoole
matroska-subtitles
💬 Streaming parser for embedded .mkv subtitles.
Stars: ✭ 40 (+29.03%)
Mutual labels:  stream
dot
distributed data sync with operational transformation/transforms
Stars: ✭ 73 (+135.48%)
Mutual labels:  stream
php-tdengine
大数据引擎 TDengine 的 PHP 客户端扩展,支持 Swoole!
Stars: ✭ 62 (+100%)
Mutual labels:  swoole
create-siler-app
🧱 Set up a modern Siler app by running one command.
Stars: ✭ 15 (-51.61%)
Mutual labels:  swoole
wlsh-framework
名词解释:wlsh( 为了生活---每个字的第一个拼音 )酷毙的码农为了生活自由,基于composer整合yaf框架与swoole等扩展,开发的php协程组件;低耦合,使用非常少的语法糖,尽量使用原有扩展中的语法。
Stars: ✭ 18 (-41.94%)
Mutual labels:  swoole
streamplify
Java 8 combinatorics-related streams and other utilities
Stars: ✭ 40 (+29.03%)
Mutual labels:  stream
xbvr
Tool to organize and stream your VR porn library
Stars: ✭ 186 (+500%)
Mutual labels:  stream
sox-stream
📣 A stream-friendly wrapper around SoX
Stars: ✭ 50 (+61.29%)
Mutual labels:  stream
swoole-cs.github.io
swoole 4.x cheat sheet
Stars: ✭ 21 (-32.26%)
Mutual labels:  swoole
rtsp-video-recorder
Provides an API to record RTSP video stream to filesystem.
Stars: ✭ 21 (-32.26%)
Mutual labels:  stream
papilo
DEPRECATED: Stream data processing micro-framework
Stars: ✭ 24 (-22.58%)
Mutual labels:  stream
TweakIt-Desktop
An Android Debugging Application
Stars: ✭ 33 (+6.45%)
Mutual labels:  stream

Http Response Emitter

Emits a Response to the PHP Server API.

The available emitter implementations are.

- `Narrowspark\HttpEmitter\SapiEmitter`
- `Narrowspark\HttpEmitter\SapiStreamEmitter`.

Note: each use the native PHP functions header() and echo to emit the response.

Note: if headers have been sent, or the output buffer exists, and has a non-zero length, the emitters raise an exception, as mixed PSR-7 / output buffer content creates a blocking issue.

If you are emitting content via echo, print, var_dump, etc., or not catching PHP errors / exceptions, you will need to either fix your app to always work with a PSR-7 response. Or provide your own emitters that allow mixed output mechanisms.

Installation

composer require narrowspark/http-emitter

Use

How to use the SapiEmitter:

<?php

use Narrowspark\HttpEmitter\SapiEmitter;

$response = new \Response();
$response->getBody()->write("some content\n");

$emitter = new SapiEmitter();
$emitter->emit($response);

If you missing the Content-Length header you can use the \Narrowspark\HttpEmitter\Util\Util::injectContentLength static method.

<?php

use Narrowspark\HttpEmitter\Util;

$response = new \Response();

$response = Util::injectContentLength($response);

Versioning

This library follows semantic versioning, and additions to the code ruleset are performed in major releases.

Changelog

Please have a look at CHANGELOG.md.

Contributing

If you would like to help take a look at the list of issues and check our Contributing guild.

Code of Conduct

Please have a look at CODE_OF_CONDUCT.md.

License

This package is licensed using the MIT License.

Please have a look at LICENSE.md.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].